Browse over 10,000 Electronics Projects

Back to the Future – Build your Flux Capacitor

Back to the Future – Build your Flux Capacitor

The sketch

To obtain the tricks of the light, the sketch that we make available on our Internet website www.elettronicain.it (along with the other project files) has to be loaded in Arduino, by means of the dedicated IDE or via a USB connection to the computer. The sketch makes use of the Neopixel.h Adafruit library, that is included since the beginning (before pins and variables are defined) by means of the following line:

 

#include <Adafruit_NeoPixel.h>

 

Soon after that a pin is assigned: it is used for the connection of the button used to select the tricks of the light (the sixth one, in this case), that is achieved via the following instruction:

 

#define BUTTON_PIN   6    

 

The communication with the LED strips is assigned to the Digital I/O 5 (D5) pin via the following instruction:



Advertisement1


 

#define PIXEL_PIN    5

 

Thus, if you wish to change Arduino’s line (for example if you mean to use Digital I/O 5 for other purposes), please modify (by editing the sketch via Arduino’s IDE) this line, by writing the desired pin number in the place of the 5, then save the sketch and load it again in Arduino.

Finally, within the sketch the number of LEDs to be driven for each strip is defined, and it amounts to 8:

 

#define PIXEL_COUNT 8

 

At this stage the firmware can be started, it can manage both the reading of the button in loop, and the visualization on the LED strips (obtained by means of a switch/case structure and the usage of the Adafruit library).

featured

Pages: 1 2 3 4 5 6

 


Top