• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!



Page history last edited by Chris 13 years, 9 months ago

This is the classic original 'blinky sketch' going back to H. Barragan and the original 'Wiring' project.

This source code compiles and runs as-is in the SFB, but there are two differences to notice:

  • First off, the SFB has several built-in LEDs, and the Arduino 'pin 13' is mapped to the 'red' portion of the central RGB LED. So this particular sketch does not require any external hardware at all.


  • The second, and more subtle, difference is that the SFB's internal LEDs are 'active low', meaning that when you digitalWrite them to a HIGH value, they go off, and when you set them LOW, they go on.  So, the loop() method in this sketch actually turns the red LED off first, and then on!

You can use ledOn, ledOff, and ledSet methods as alternative ways of controlling the internal LEDs, with less chance of confusion.


Initialize sketch directory

Pick a name for your sketch. Note that this name will become the name of the directory holding the sketch code. 

$ mkdir ~/sketches

$ mkdir ~/sketches/blinky

$ cd ~/IXM/SFB

$ make SKETCH_DIR=~/sketches/blinky sketchinit



Edit ~/sketches/blinky/sketch.pde In this example, we'll just paste in a version of the regular old 'blinking LED' code:

/* Blinking LED
 * ------------
 * turns on and off a light emitting diode(LED) connected to a digital  
 * pin, in intervals of 2 seconds. Ideally we use pin 13 on the Arduino 
 * board because it has a resistor attached to it, needing only an LED

 * Created 1 June 2005
 * copyleft 2005 DojoDave <http://www.0j0.org>
 * http://arduino.berlios.de
 * based on an orginal by H. Barragan for the Wiring i/o board

int ledPin = 13;                 // LED connected to digital pin 13

void setup()
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output

void loop()
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second

Build sketch

$ cd ~/sketches/blinky

$ make


Upload sketch

$ cd ~/IXM/SFB

$ ./targets/host/bin/sfbdl -f ~/sketches/blinky/sketch.hex -d /dev/ttyUSB0




Comments (0)

You don't have permission to comment on this page.