3. Bread Board & LED - Spark Core

Let’s connect a LED to the bread board and control it. You may want to read http://www.instructables.com/id/Breadboard-How-To/ to learn how to use bread board.
As described in http://docs.spark.io/examples/, we need a resistor. Disconnect your core from USB cable and connect LED, resistor and core.
Please note that the longer lead of LED is positive.


Then it blinks!

// We name pin D0 as led
int led = D0;

// This routine runs only once upon reset
void setup()
{
  // Initialize D0 pin as output
  pinMode(led, OUTPUT);
}

// This routine loops forever
void loop()
{
  digitalWrite(led, HIGH);   // Turn ON the LED
  delay(1000);               // Wait for 1000mS = 1 second
  digitalWrite(led, LOW);    // Turn OFF the LED
  delay(1000);               // Wait for 1 second
}

https://github.com/higepon/Spark-Core-Examples/blob/master/3.Connect%20LED.ino