Update BlinkNcount.ino
Uses `#define` for LED pin instead of 5 literals
This commit is contained in:
parent
2c33a02371
commit
15ce8137b9
|
@ -1,32 +1,35 @@
|
||||||
/*
|
/*
|
||||||
BlinkNcount for Maple Mini by m. ray burnette
|
BlinkNcount for Maple Mini by m. ray burnette, update by The Lightning Stalker to use #define
|
||||||
Sketch uses 13,808 bytes (12%) of program storage space. Maximum is 108,000 bytes.
|
Sketch uses 13,808 bytes (12%) of program storage space. Maximum is 108,000 bytes.
|
||||||
Global variables use 2,592 bytes of dynamic memory.
|
Global variables use 2,592 bytes of dynamic memory.
|
||||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||||
Counts and displays the count on the attached serial monitor
|
Counts and displays the count on the attached serial monitor
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define LED_PIN PB1 // Maple Mini LED is on PB1, other boards may vary
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// initialize the digital pin as an output.
|
// initialize the digital pin as an output.
|
||||||
pinMode(33, OUTPUT);
|
pinMode(LED_PIN, OUTPUT);
|
||||||
// Initialize virtual COM over USB on Maple Mini
|
// Initialize virtual COM over USB on Maple Mini
|
||||||
Serial.begin(9600); // BAUD has no effect on USB serial: placeholder for physical UART
|
Serial.begin(9600); // BAUD has no effect on USB serial: placeholder for physical UART
|
||||||
// wait for serial monitor to be connected.
|
// wait for serial monitor to be connected.
|
||||||
while (!Serial)
|
while (!Serial)
|
||||||
{
|
{
|
||||||
digitalWrite(33,!digitalRead(33));// Turn the LED from off to on, or on to off
|
digitalWrite(LED_PIN, !digitalRead(LED_PIN)); // Turn the LED from off to on, or on to off
|
||||||
delay(100); // fast blink
|
delay(100); // fast blink
|
||||||
}
|
}
|
||||||
Serial.println("Blink LED & count Demo");
|
Serial.println("Blink LED & count Demo");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
digitalWrite(33, HIGH); // set the LED on
|
digitalWrite(LED_PIN, HIGH); // set the LED on
|
||||||
delay(500); // wait for a second
|
delay(500); // wait for a second
|
||||||
digitalWrite(33, LOW); // set the LED off
|
digitalWrite(LED_PIN, LOW); // set the LED off
|
||||||
Serial.print("Loop #: ");
|
Serial.print("Loop #: ");
|
||||||
n++;
|
n++;
|
||||||
Serial.println(n);
|
Serial.println(n);
|
||||||
|
|
Loading…
Reference in New Issue