Code for controlling servos using the TLC5940 pwm led driver.
Embed:
(wiki syntax)
Show/hide line numbers
TLC5940.h
00001 #ifndef TLC5940_H_ 00002 #define TLC5940_H_ 00003 00004 #include "mbed.h" 00005 00006 class TLC5940 { 00007 private: 00008 SPI * _spi; 00009 PwmOut * _gsclk; 00010 DigitalOut * _xlat; 00011 DigitalOut * _blank; 00012 Ticker * _t; 00013 int gs_data[16]; 00014 public: 00015 TLC5940(PinName mosi, PinName miso, PinName sck, PinName xlat, PinName blank, PinName gsclk); 00016 void setServo(int ch, int val); 00017 void flush(); 00018 void run(); 00019 void refresh(); 00020 }; 00021 00022 #endif /* TLC5940_H_ */
Generated on Tue Jul 19 2022 00:52:38 by
1.7.2