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
RotaryEncoder.cpp
- Committer:
- isonno
- Date:
- 2012-01-16
- Revision:
- 2:965388eecf95
- Parent:
- 0:6da5625a6946
File content as of revision 2:965388eecf95:
// Rotary Encoder // Support for the rotary encoder control #include "RotaryEncoder.h" RotaryEncoder::RotaryEncoder( PinName a, PinName b, PinMode mode ) : fPinA( a ), fPinB( b, mode ) { fPinA.mode( mode ); fPinB.setSampleFrequency( 3000 ); fPinB.attach_asserted( this, &RotaryEncoder::bRise ); } void RotaryEncoder::debug( const char * where ) { // printf("%s: as: %d, bs: %d: aCh: %c, bCh: %c\r\n", // where, aState, bState, aChanged ? 'T' : 'F', bChanged ? 'T' : 'F' ); } void RotaryEncoder::bRise() { // The status of the A channel on the B channel's rising edge // determines which way the shaft is turning. if (fPinA.read()) fCallback.call( 1 ); else fCallback.call( -1 ); }