Skip to content

Commit 15ce813

Browse files
Update BlinkNcount.ino
Uses `#define` for LED pin instead of 5 literals
1 parent 2c33a02 commit 15ce813

File tree

1 file changed

+12
-9
lines changed
  • STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount

1 file changed

+12
-9
lines changed
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
/*
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
33
Sketch uses 13,808 bytes (12%) of program storage space. Maximum is 108,000 bytes.
44
Global variables use 2,592 bytes of dynamic memory.
55
Turns on an LED on for one second, then off for one second, repeatedly.
66
Counts and displays the count on the attached serial monitor
77
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+
912
int n = 0;
1013

1114

12-
void setup() {
15+
void setup() {
1316
// initialize the digital pin as an output.
14-
pinMode(33, OUTPUT);
17+
pinMode(LED_PIN, OUTPUT);
1518
// Initialize virtual COM over USB on Maple Mini
1619
Serial.begin(9600); // BAUD has no effect on USB serial: placeholder for physical UART
1720
// wait for serial monitor to be connected.
1821
while (!Serial)
1922
{
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
2124
delay(100); // fast blink
2225
}
2326
Serial.println("Blink LED & count Demo");
2427
}
2528

2629
void loop() {
27-
digitalWrite(33, HIGH); // set the LED on
30+
digitalWrite(LED_PIN, HIGH); // set the LED on
2831
delay(500); // wait for a second
29-
digitalWrite(33, LOW); // set the LED off
32+
digitalWrite(LED_PIN, LOW); // set the LED off
3033
Serial.print("Loop #: ");
3134
n++;
3235
Serial.println(n);
33-
34-
delay(500); // wait
36+
37+
delay(500); // wait
3538
}

0 commit comments

Comments
 (0)