Experiment with the LEDStrip by changing the code
Now we will experiment with the LedStrip example code, created by FemTech.dk, and which you placed in your FemTech.dk folder on your desktop. (if you do not have it on your computer, you can go to the installation guide at the bottom to see how to download it step by step – or click this link: exampleCode.zip directly).
Find your FemTech.dk folder and open the sub-folder labelled: “exampleCode” – go into this folder and click the Arduino file exampleCode.ino
(Troubleshooting: If the exampleCode does not run, check if you have downloaded the pixel files and placed the files in the library folder – see step 01)
When you have the open file (exampleCode) and scroll down to the void ledLoop() and you should see the below code:
Try to compile and upload the code to your Thing and see what happens. What the above code says is to take the current LED, and turn it off, then move to the next, and turn it on with the color green, then wait 2 sec. This code runs in a loop.
Experiment: Make the lights a different color – try red or maybe blue?
Experiment: Make your own color pattern.
In your Arduino file, you can see different ‘tab’ in the top – called ‘CircleLeds.cpp’ or ‘utility_functions’ – if you click the ‘tab’ utility_functions’ and scroll down, you will see a function called int color(const char*name) – see below
Try to change the code and make your own color – give it a name like ‘Pernille colour’ save and go back to the tab ‘LedExample’ and use your new color on your LED strip. Compile and upload the code and see what happens.
Experiment: Try to make a rainbow – the different LEDs blink in different colours – use below code for inspiration:
Experiment: Try to dim the brightness of the colors, use below code for inspiration:
Experiment: Try to make only one specific LED blink (not the whole row) using a dimmed brightness – e.g. number 4 (remember we start counting from 0): Use the below code for inspiration – hint: Try to replace currentLed.get() with 4
Are there other things you would like to do with the LEDstrip? Maybe mixing the colors or the order by which the LED is blinking?
One that you are done with experimenting with the LED Strip, we will move to the next step: getting to know the motion sensor
05) Getting to know the motion sensor: accelerometer and gyroscope