Arduino Code for controlling a 5 x 5 x 5 RGB LED Cube with 74hc595 ICs
- Copy
TemplateAnimation.cppandTemplateAnimation.hinto themainfolder. - Rename the two files to the name your animation should have.
- By using search and replace, replace all occurences of
TemplateAnimationwith the name of your animation. - Write your own animation code. If you declare new methods or class variables, write their signatures into the header file. Initialize variables in the constructor (watch out for arrays)
- Go to
main.ino, add a statement to include your animation header file. - Change the type of the animation object to your animation.
Good to know:
- Variables defined outside of a method are global and thus MUST HAVE A UNIQUE NAME!. This is not ideal, so please only use class variables, defined in the header file.
- Look at Cube.h to get an idea of what is already implemented to change leds.
- Framerate can be set in the constructor of your animation.
- Default Framerate for all animations that don't specify a framerate can be changed in Animation.h
- Up to 175 fps are guaranteed to work! (even after the upgrade to pwm, but only achievable if the calculation of the frame is not demanding)
- Instead of bitvalues, you can use the color constants defined in
ColorConstants.h.
- Write your method in
Cube.cpp. - Add your method signature to
Cube.h.