Scrolling text on a rainboduino
Spent a little time last night at Hackspace writing some basic code to scroll some text across a rainbowduino.
I use arduino-mk ( pacakge available on debian ) so here is the basic makefile to build it.
BOARD_TAG = atmega328 ARDUINO_LIBS = Rainbowduino ARDUINO_DIR = /usr/share/arduino ARDMK_DIR = /usr/share/arduino AVR_TOOLS_DIR = /usr include /usr/share/arduino/Arduino.mk
/* Rainbowduino v3.0 Scrolling text */ #include <Rainbowduino.h> String message = "John is ace!"; void setup() { Rb.init(); } unsigned char x,y,z; void scroll_text(String msg) { int len = msg.length(); const int kern = 6; byte msg_b[len+1]; msg.getBytes(msg_b, len+1); for (int i = 0; i <= len * kern ; i++) { for (int b = 0 ; b < len ; b++) { if ((b * kern) > ( i - kern) && (b * kern) < (i + kern) ) { Rb.drawChar(msg_b[b],- i + (b * kern),1,random(0xFFFFFF)); } } delay(200); Rb.blankDisplay(); } } void loop() { scroll_text(message); }
Comments
Comments powered by Disqus