|
Post by chuckl73 on Feb 23, 2019 16:57:02 GMT
I don't understand how to share variables between cores on the ShieldBuddy, even after reading the user manual. This is a simple program trying to understand it, however it doesn't work. Can someone show me what I'm doing wrong or post an example. This is the error message when compiling - " 'c' was not declared in this scope". Chuck /*** Core 0 ***/ void setup() { // put your setup code for core 0 here, to run once:
SerialASC.begin(9600);
}
void loop() { // put your main code for core 0 here, to run repeatedly:
delay(5); /* Make it look like this core is doing something useful! */
/* If ASC is free lock it */ while(Htx_LockResource(&SerialASC.PortInUse) == Htx_RESOURCE_BUSY) { ; } SerialASC.println(c);
Htx_UnlockResource(&SerialASC.PortInUse);
}
/*** Core 1 ***/ void setup1() { }
void loop1() { // put your main code for core 1 here, to run repeatedly:
int a = 10; int b = 13; int c = a + b;
while(Htx_LockResource(&SerialASC.PortInUse) == Htx_RESOURCE_BUSY) { ; }
Htx_UnlockResource(&SerialASC.PortInUse);
}
/*** Core 2 ***/ void setup2() { // put your setup code for core 2 here, to run once:
}
void loop2() { // put your main code for core 2 here, to run repeatedly:
delay(25); /* Make it look like this core is doing something useful! */
while(Htx_LockResource(&SerialASC.PortInUse) == Htx_RESOURCE_BUSY) { ; }
//SerialASC.print("Hello from Core 2\n\r");
Htx_UnlockResource(&SerialASC.PortInUse);
}
|
|
|
Post by Admin on Feb 23, 2019 17:55:51 GMT
|
|