Code for controlling servos using the TLC5940 pwm led driver.
Diff: TLC5940.h
- Revision:
- 0:bdf7a64b89a7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TLC5940.h Sun Mar 24 16:23:29 2013 +0000 @@ -0,0 +1,22 @@ +#ifndef TLC5940_H_ +#define TLC5940_H_ + +#include "mbed.h" + +class TLC5940 { +private: + SPI * _spi; + PwmOut * _gsclk; + DigitalOut * _xlat; + DigitalOut * _blank; + Ticker * _t; + int gs_data[16]; +public: + TLC5940(PinName mosi, PinName miso, PinName sck, PinName xlat, PinName blank, PinName gsclk); + void setServo(int ch, int val); + void flush(); + void run(); + void refresh(); +}; + +#endif /* TLC5940_H_ */ \ No newline at end of file