Source code for the Curilights Controller. See http://www.saccade.com/writing/projects/CuriController/ for details.
Dependencies: FatFileSystem mbed
This is the source code for the Curilights controller. This lets you interactively control a string of Curilights. It provides a simple click-wheel user interface for changing colors, brightness and behavior. It responds to movement and lighting.
Finished Controller
System Block Diagram
Diff: SerialConnect.cpp
- Revision:
- 0:6da5625a6946
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SerialConnect.cpp Thu Dec 29 01:59:53 2011 +0000 @@ -0,0 +1,26 @@ +// SerialConnect.cpp - Connect two serial ports together + +#include "mbed.h" + +#include "SerialConnect.h" + +SerialConnect::SerialConnect( PinName txA, PinName rxA, + PinName txB, PinName rxB ) +: fPortA( txA, rxA ), fPortB( txB, rxB ) +{ + fPortA.attach( this, &SerialConnect::HandleAtoB ); + fPortB.attach( this, &SerialConnect::HandleBtoA ); +} + +void SerialConnect::HandleAtoB() +{ + while (fPortA.readable()) + fPortB.putc(fPortA.getc()); +} + +void SerialConnect::HandleBtoA() +{ + while (fPortB.readable()) + fPortA.putc( fPortB.getc() ); +} +