/* An improved version of the blink sketch. * blinkv2 * * Removing the use of LED_BUILTIN * Defining our pin * Understanding pinMode() * Understanding digitalWrite() * Understanding HIGH and LOW and it's alternatives * * pin 13 ...LED */ // This line is OK, but using const int is much better and safer //int ledPin = 13;//pin 13 has a built in LED //const int is an int that cannot have it's value changed const int ledPin = 13;//pin 13 has a built in LED // the setup function runs once when you press reset or power the board void setup() { // Serial.begin(9600) starts serial communication. 9600bps bits per second = 1200 characters per second Serial.begin(9600); //Send script name Serial.println("blinkv2..."); //this will print a blank line Serial.println(" "); //The original LED_BUILTIN in has been removed as it can lead to bad habits in not defining a variable //Also it will not work on other makes of board. //pinMode(LED_BUILTIN, OUTPUT); //A digital pin can be an INPUT or an OUTPUT. Input is used to read incoming data, OUTPUT makes the pin //into a digital switch to send outgoing data. pinMode(ledPin, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }