I've wrapped everything up into an app on the Open Source App Store over here. The app includes 3 files:
- SoftwareSerial_NB.zip - This should be dropped into folder: hardware\arduino\cores\genesis\src\components\library
- TouchShield_Pulsing_Sleep.pde - This is a sketch that implements the PWM duty cycle value to the Illuminato Genesis, using the bling() function
- Illuminato_Serial_Bling.pde - Listens for PWM duty cycle value from the TouchShield and controls the virtual bling LEDs on the front of the TouchShield Slide
So the first step was to implement PWM light control, which is accomplished with this snippet of code:
/* Software PWM modulation routine */
void pwm_bling(char duty) {
int duration;
duration = (millis() - pTime);
if (duration <= duty) {
bling(1);
} else {
bling(0);
}
if (duration >= period ) {
pTime = millis();
}
}
Then, using serial communications between the Illuminato Genesis and the TouchShield Slide, the PWM'ing is synchronized so that both boards are pulsing at the same speed. The effect is pretty cool looking, if you ask me. On the one hand, you have real LED's on the back of the Illuminato pulsing, and then you have virtual LED's on the TouchShield Slide's OLED pulsing.
Here's the video:
And here are some other pictures:
No comments:
Post a Comment