Home » Control a LED

This tutoriel allows to command a simple led with the Esus board.

Schematic

Schematic with a led and 180 ohm resisitor.

  • IO2 : Input/Output 2
  • Gnd : ground (0V)

schema_v2

Turn on

A simple program for turn on a led :

#include <esusBoard.h>

// led on IO2 pin
int ledPin = 2;

void setup() 
{
  // initialisation esus board
  initEsusBoard();

  // initialisation IO2 
  pinMode(ledPin, OUTPUT);

}

void loop() 
{
  turn on
  digitalWrite(ledPin, HIGH);
}

Blink the led :

void loop() 
{

  digitalWrite(ledPin, HIGH);

  delay(2000);

  digitalWrite(ledPin, LOW);

  delay(2000);
}