Yet antoher blinking example?

Let’s start with short movie. Yet another blinking example, but this time, can You spot something unusual for such example?

Well, If You haven’t noticed, LED is connected to analog input! So. how it could work? First one question – do You know where are located I2C pins on Arduino UNO? It is on analog inputs A4 & A5 (of course all R3 boards have additional pins with SDA & SDL, but these are electrically connected to the pins A4&A5 on UNO).

Yes, that means that analog inputs can work as regular digital inputs/outputs. Just set proper mode (input/output) via pinMode and ATmega will disable analog input. Like all others digital inputs these have also pullup resistor. Enable it with the same sequence like for other digital inputs (pinMode(A0, INPUT); digitalWrite(A0,HIGH);)

Sketch working on Arduino showed on movie is

void setup() {                
  pinMode(A0, OUTPUT);     
}
void loop() {
  digitalWrite(A0, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(A0, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

You just can use defined symbols A0-A5 to address analog ports, each one can be set in digital/analog mode independently.