This project uses Arduino software, Google Sketchup, and 3-D printing technology.

Step 1: The Arduino Code

For our final code, we compiled both the .h and .ino files from separate tabs in the arduino development environment (IDE.) The color.h needs a code from the neopixel library, as shown by “ # include In color.h : .h = header -- where you put class or object definitions for your code “class Color” is the object definition for the colors. “public” means any part of the whole code can use this part of the color object (as opposed to “private”.) The “Color()” part is an object constructor or creator. It is called by the keyword “new” in the code (see next paragraph). It sets the initial value of _r, _g, and _b to 0.0. The “Color(float r, float g, float b)” part means the data type value is a non-integer, or fraction, so the colors from the neopixel will be selected from something like a color wheel. The next set of instructions “Color (float h)” is another constructor with different parameters. It is saying given a desired hue, it gives you a color. “case 0” “case 1” and “case 2” are the different options with the different hues of red, green, and blue. Now, the instructions are to blend the colors in order to change the color. Again, “private” means no other code can access it, but for this project, it won’t make a difference in the end if it is private or public. This is a concept of data hiding that may impact the result more in the long run; it is a good “coding practice.” “void checkLimits ()” is to ensure that the values for _r, _g, _b, are within the set range.

In the other .ino file : .ino = IDE file, or project file. It is the main file of the project.

As stated earlier, “#include ” means the code uses a library from neo-pixel, and “#include ‘Color.h’” means the code uses the other file (from above) called Color.h. “Adafruit_NeoPixel strip = Adafruit_NeoPixel(3,7,NEO_GRB + NEO_ KHZ800)” sets the object type, so the computer knows “strip” is the neopixel, and 7 is the pin to use to control the strip. “void setup ()” is the arduino setup; within that, “strip.begin” and “strip.show” means a clean start for the neopixel and initializes all pixels to “off.” “pinMode(13, OUTPUT)” sets pin 13 to an output; we can see the orange light blinking next to the pin. “Color c1” “Color c2” and “Color c3” is a declaration stating basically “I want 3 color objects.” “voidloop()” is a forever loop that arduino executes so the colors keep going on. “Color new1” “Color new2” and “Color new3” instantiates using color cons

Step 2: The Sketchup Design

This sleek design encloses the Arduino hardware. The light of the candle is a Neopixel, programmed with the Arduino.

Step 3: The Arduino Hardware

A wire connects pin 7 to the top hole in the Neopixel.

A wire connects VIN to the left hole in the Neopixel.

A wire connects GND to the right hole in the Neopixel.

Step 4: 3-D Printing

About This Instructable




More by kristentamsil:Arduino Candle 
Add instructable to: