Skip to content

Instantly share code, notes, and snippets.

@e-Gizmo
Created December 6, 2013 06:00
Show Gist options
  • Save e-Gizmo/7819249 to your computer and use it in GitHub Desktop.
Save e-Gizmo/7819249 to your computer and use it in GitHub Desktop.
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
The circuit:
* LED connected from digital pin 13 to ground.
* Note: On most Arduino boards, there is already an LED on the board
connected to pin 13, so you don't need any extra components for this example.
Created 1 June 2005
By David Cuartielles
http://arduino.cc/en/Tutorial/Blink
based on an orginal by H. Barragan for the Wiring i/o board
*/
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
// pinMode(0, OUTPUT);
// pinMode(1, OUTPUT);
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
pinMode(A4, OUTPUT);
pinMode(A5, OUTPUT);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
if (digitalRead(2) == LOW)
digitalWrite(12, HIGH); // set the LED off
else
digitalWrite(12, LOW); // set the LED off
if (digitalRead(3) == LOW)
digitalWrite(13, HIGH); // set the LED off
else
digitalWrite(13, LOW); // set the LED off
if (digitalRead(4) == LOW)
digitalWrite(A0, HIGH); // set the LED off
else
digitalWrite(A0, LOW); // set the LED off
if (digitalRead(5) == LOW)
digitalWrite(A1, HIGH); // set the LED off
else
digitalWrite(A1, LOW); // set the LED off
if (digitalRead(6) == LOW)
digitalWrite(A2, HIGH); // set the LED off
else
digitalWrite(A2, LOW); // set the LED off
if (digitalRead(7) == LOW)
digitalWrite(A3, HIGH); // set the LED off
else
digitalWrite(A3, LOW); // set the LED off
if (digitalRead(8) == LOW)
digitalWrite(A4, HIGH); // set the LED off
else
digitalWrite(A4, LOW); // set the LED off
if (digitalRead(9) == LOW)
digitalWrite(A5, HIGH); // set the LED off
else
digitalWrite(A5, LOW); // set the LED off
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment