@@ -5,8 +5,8 @@ void setup()
55 Serial.begin (115200 );
66 delay (1000 );
77
8- // Create a group of pin
9- uint8_t group[] = {LED_BUILTIN, 12 , 11 , 10 , 9 , 8 };
8+ // Create a group of pins
9+ byte group[] = {LED_BUILTIN, 12 , 11 , 10 , 9 , 8 };
1010
1111 // Print that group
1212 printArray (group, LEN (group));
@@ -20,14 +20,14 @@ void setup()
2020 digitalWriteGroup (group, LEN (group), LOW);
2121
2222 // Toggle the state of a pin
23- for (uint8_t n = 0 ; n < 5 ; n++)
23+ for (byte n = 0 ; n < 5 ; n++)
2424 {
2525 digitalToggle (LED_BUILTIN);
2626 delay (500 );
2727 }
2828
2929 // Or toggle a group of pins
30- for (uint8_t n = 0 ; n < 5 ; n++)
30+ for (byte n = 0 ; n < 5 ; n++)
3131 {
3232 digitalToggleGroup (group, LEN (group));
3333 delay (500 );
@@ -44,9 +44,12 @@ void setup()
4444 Serial.println (substring); // this will output "test"
4545
4646 // A more complex array for printArray
47- uint8_t array[] = {1 , 0x56 , 0b1011 };
47+ int array[] = {1 , 11 , 89 , 34 , 9 };
4848
49- // Print the array as hexadecimal values with a ":" between the items and invert it (from the last to the first)
49+ // Print the array as decimal values with a ", " between the items and invert them (from the last to the first)
50+ printArray (array, LEN (array), " , " , DEC, true );
51+
52+ // Print the array as hexadecimal values with a ":" between the items and invert them (from the last to the first)
5053 printArray (array, LEN (array), " :" , HEX, true );
5154
5255 // Print the array as binary values with a newline ("\n") between the items and write the index before every element
@@ -56,4 +59,19 @@ void setup()
5659 // echo(&Serial, &Serial2);
5760}
5861
59- void loop () {}
62+ unsigned long task1, task2;
63+
64+ void loop ()
65+ {
66+ // This will be run every 3500 milliseconds (3.5 seconds)
67+ if (doEvery (&task1, 3500 ))
68+ {
69+ Serial.println (" Hello, from task1" );
70+ }
71+
72+ // This every 10 seconds
73+ if (doEvery (&task2, 10000 ))
74+ {
75+ Serial.println (" Also from task2!" );
76+ }
77+ }
0 commit comments