Engduino Lights Tutorial - Basics
This tutorial will teach you the basics of communicating with your Engduino.
First, make sure you're in "coder" or "expert" skill level.
This option is on the "learn" part of the touchdevelop
homepage. Then, you want to click "Create Script" in the
"my scripts" section, and type "blank engduino". Select
the option shown in the picture below.
Then, the first thing you'll see is
an action called "main". This is
where the loop is called, inside
a while loop with condition
"true". This means the loop will
keep running continuously,
repeating your commands over
and over again.
Now, you want to go the "loop" action, so click on
then click
The first thing you'll see is this code. This is
example code, showing how you set your
Engduino's LEDs to turn on and turn off
repeatedly, with random colours chosen
each time.
Go ahead and try it out by pressing then the
button.
(Make sure the Engduino is plugged in to your computer and turned on!)
For this tutorial, keep the example code. In future tutorials, follow the above steps as usual and
delete the 4 lines of example code, before following the steps I will give you afterwards.
Now that you've seen it running the
example code, it's time to add to it. Look
at this code.
I have added 4 lines to the example code.
It turns 3 of the LEDs (2, 4 and 6) red,
green and blue, after the example code
turns the LEDs off.
The Engduino has 16 LEDs, and each has
its own number from 1 to 16.
You may be wondering what this code does. The first line declares the "loop" action, which was
previously called in "main" as you saw earlier.
Then all the LEDs are set to a random colour. A short delay then makes sure these LEDs stay on for a
moment, before they are set to black, where they turn off.
There is then another delay, followed by LEDs set individually (using "set LED" instead of "set all
LEDs". Go ahead and run it on your Engduino again to see what it does.
Great! You now know the basics of communicating with your Engduino and setting the LEDs. In the
next tutorials, you will be surprised with how much you can do with it!