Last active
February 23, 2019 10:49
-
-
Save avbelyaev/ccfdac5d92fbe59bd3147d30f4d3108e to your computer and use it in GitHub Desktop.
Arduino UNO blinker
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
// Arduino UNO | |
// Programmer: AVRISP mkII | |
/* | |
Blink | |
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO | |
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to | |
the correct LED pin independent of which board is used. | |
If you want to know what pin the on-board LED is connected to on your Arduino | |
model, check the Technical Specs of your board at: | |
https://www.arduino.cc/en/Main/Products | |
*/ | |
int COUNTER; | |
void setup() { | |
COUNTER = 0; | |
// initialize digital pin LED_BUILTIN as an output. | |
pinMode(LED_BUILTIN, OUTPUT); | |
// when arduino starts, it prints its baud rate (bits per second). then we set its rate here | |
Serial.begin(115200); | |
} | |
void loop() { | |
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(800); // wait for a second | |
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW | |
delay(400); // wait for a second | |
COUNTER = COUNTER + 1; | |
// after baud rate is set we can open port monitor (rightmost button in arduino IDE) | |
// and set it's read rate same as arduinos write rate. then we can print in java-like style :) | |
Serial.println("hello!"); | |
Serial.println(COUNTER); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment