|
1 | 1 | /* |
2 | | - BlinkNcount for Maple Mini by m. ray burnette |
| 2 | + BlinkNcount for Maple Mini by m. ray burnette, update by The Lightning Stalker to use #define |
3 | 3 | Sketch uses 13,808 bytes (12%) of program storage space. Maximum is 108,000 bytes. |
4 | 4 | Global variables use 2,592 bytes of dynamic memory. |
5 | 5 | Turns on an LED on for one second, then off for one second, repeatedly. |
6 | 6 | Counts and displays the count on the attached serial monitor |
7 | 7 | This example code is in the public domain. |
8 | | - */ |
| 8 | +*/ |
| 9 | + |
| 10 | +#define LED_PIN PB1 // Maple Mini LED is on PB1, other boards may vary |
| 11 | + |
9 | 12 | int n = 0; |
10 | 13 |
|
11 | 14 |
|
12 | | -void setup() { |
| 15 | +void setup() { |
13 | 16 | // initialize the digital pin as an output. |
14 | | - pinMode(33, OUTPUT); |
| 17 | + pinMode(LED_PIN, OUTPUT); |
15 | 18 | // Initialize virtual COM over USB on Maple Mini |
16 | 19 | Serial.begin(9600); // BAUD has no effect on USB serial: placeholder for physical UART |
17 | 20 | // wait for serial monitor to be connected. |
18 | 21 | while (!Serial) |
19 | 22 | { |
20 | | - digitalWrite(33,!digitalRead(33));// Turn the LED from off to on, or on to off |
| 23 | + digitalWrite(LED_PIN, !digitalRead(LED_PIN)); // Turn the LED from off to on, or on to off |
21 | 24 | delay(100); // fast blink |
22 | 25 | } |
23 | 26 | Serial.println("Blink LED & count Demo"); |
24 | 27 | } |
25 | 28 |
|
26 | 29 | void loop() { |
27 | | - digitalWrite(33, HIGH); // set the LED on |
| 30 | + digitalWrite(LED_PIN, HIGH); // set the LED on |
28 | 31 | delay(500); // wait for a second |
29 | | - digitalWrite(33, LOW); // set the LED off |
| 32 | + digitalWrite(LED_PIN, LOW); // set the LED off |
30 | 33 | Serial.print("Loop #: "); |
31 | 34 | n++; |
32 | 35 | Serial.println(n); |
33 | | - |
34 | | - delay(500); // wait |
| 36 | + |
| 37 | + delay(500); // wait |
35 | 38 | } |
0 commit comments