Skip to content

Instantly share code, notes, and snippets.

@mjdargen
Created July 1, 2020 03:16
Show Gist options
  • Save mjdargen/92a5797b73edc5786ce2fe28ac81bd6f to your computer and use it in GitHub Desktop.
Save mjdargen/92a5797b73edc5786ce2fe28ac81bd6f to your computer and use it in GitHub Desktop.
/* Activity 00 - Blinky
Turns LED on for one second, then off for one second, repeatedly.
Sends a serial message indicating whether LED is "on" or "off".
Uses onboard LED connected to pin 13.
*/
#define LED_PIN 13 // define LED pin
// put your setup code here, to run once:
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
// initialize digital pin 13 (LED) as an output
pinMode(LED_PIN, OUTPUT);
}
// put your main code here, to run repeatedly:
void loop() {
digitalWrite(LED_PIN, HIGH); // turn the LED on
Serial.println("on"); // tell PC LED is on
delay(1000); // wait for a second
digitalWrite(LED_PIN, LOW); // turn the LED off
Serial.println("off"); // tell PC LED is off
delay(1000); // wait for a second
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment