Merge pull request #371 from LightningStalker/master

Update BlinkNcount.ino to use LED_BUILTIN rather than a pin number (which is specific to one board).
Note. LED_BUILTIN needs to be defined for some variants where its missing
This commit is contained in:
Roger Clark 2017-11-14 09:18:41 +11:00 committed by GitHub
commit a7503e1d30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -11,22 +11,22 @@ 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_BUILTIN, 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_BUILTIN,!digitalRead(LED_BUILTIN)); // 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_BUILTIN, 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_BUILTIN, LOW); // set the LED off
Serial.print("Loop #: "); Serial.print("Loop #: ");
n++; n++;
Serial.println(n); Serial.println(n);