Micro controllers can generate signals or understand if there is a signal on one of its input pins. Signals mean having electricity or logic state high in micro controller jargon. If there is no signal on a pin of a microcontroller, its state is logic low. You can program output pins of a microcontroller to be high or low. You can also test input pin of a microcontroller if its state is high or low. This is all about the digital I/O. Digital I/O stands for Digital Input and OutputDigital Inputs allow a microcontroller to detect logic states, and Digital Outputs allow a microcontroller to output logic states.

For our Lightino, the RGB LEDs are connected to the microcontroller’s digital pins. We can make that pin Logic High to illuminate the LED which is connected to that pin. But first, we must tell the microcontroller that we will use the LED pins as output.

Here is the code to set a pin as an output. Arduino library has great functions to help us.

pinMode(ledPin, OUTPUT);

After setting the pinMode as output lets make it logic high. Here is the code

 digitalWrite(ledPin, HIGH); 

That’s it! You’ve done. The led is on.

So how can we make it off? It is also easy;

 digitalWrite(ledPin, LOW); 

Up to now you learn 3 lines of code but be sure that you can use Lightino with these 3 lines of code. If you are familiar with the basics of Arduino you know the setup() and loop() functions. If not no problem, I will tell you. Every sketch needs two void type functions, setup() and loop(). A void type function means It doesn’t return any value. So the anatomy of an empty Arduino sketch (sketch means Arduino program) is like below;

void setup()
void loop()

Now it’s time to your first Lightino Program. Download and install Arduino IDE (Arduino development environment)


You can watch these videos related with your operating system.

You may also want to watch some more videos related with Arduino fundementals.


Now it’s your turn

Open a new empty sketch.Copy and paste the code at the end of the page to your Arduino IDE. Then connect the Lightino USB port to your computer USB port. Select from tools menu board and Arduino Leonardo Then again from tools menu select port and the USB port of the lightino. lastly, press upload button

The lightino onboard arduino red leds will flash and you will see that uploading done at the bottom of the IDE.

Congratulations You have finished the Lesson 1

If you have some commands below that you do not understand, We will cover them in other Lessons.

void setup() {
// initialize digital pin LED as an output.
pinMode(9, OUTPUT); //9 means LED1

// the loop function runs over and over again forever
void loop() {
digitalWrite(9, HIGH); // turn the LED on
delay(1000); // wait for a second
digitalWrite(9, LOW); // turn the LED off 
delay(1000); // wait for a second