Created
August 18, 2020 08:34
-
-
Save erm3nda/e262d1f62c9fac678db066a813a19d5d to your computer and use it in GitHub Desktop.
Arduino blinking led example but fixed to work also on boards with less PIN, ie attiny85 #arduino #c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
// Attiny85 doesn't have nor recognize LED_BUILTIN 13 from Arduino.h | |
// Little fix to enable led blink with a LED on PIN 3 + GND to test boards. | |
#ifndef LED_BUILTIN | |
#define LED_BUILTIN 3 | |
#endif | |
void setup() { | |
// initialize digital pin LED_BUILTIN as an output. | |
Serial.begin(9600); | |
pinMode(LED_BUILTIN, OUTPUT); | |
Serial.write(LED_BUILTIN + "\n"); | |
} | |
// the loop function runs over and over again forever | |
void loop() { | |
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(1000); // wait for a second | |
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW | |
delay(1000); // wait for a second | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment