-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmy02a-dual-core.ino
39 lines (31 loc) · 1007 Bytes
/
my02a-dual-core.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
my02-Dual-Core for the Portenta H7
This code can be loaded on either core.
The M7 core will initialize the M4 core
M7 will flash Blue randomly (under 6 seconds)
The M4 will flash Green randomly (under 6 seconds)
July 22nd, 2020
by Jeremy Ellis
Twitter @rocksetta
Website https://www.rocksetta.com
*/
int myLED;
// the setup function runs once when you press reset or power the board
void setup() {
randomSeed(analogRead(A0));
#ifdef CORE_CM7
LL_RCC_ForceCM4Boot();
myLED = LEDB; // on-board blue LED
#endif
#ifdef CORE_CM4
myLED = LEDG; // on-board greeen LED
#endif
pinMode(myLED, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(myLED, LOW); // turn the LED on (LOW is the voltage level)
delay(200); // wait for a second
digitalWrite(myLED, HIGH); // turn the LED off by making the voltage HIGH
delay( rand() % 5000 + 1000); // wait for a random amount of time below 6 seconds.
}