Hello world for the TLC5940Servo library.
Dependencies: TLC5940Servo mbed
main.cpp
- Committer:
- dudanian
- Date:
- 2014-10-21
- Revision:
- 0:0b054b47ac3d
- Child:
- 1:aeb0ed70cbd0
File content as of revision 0:0b054b47ac3d:
#include "mbed.h" #include "TLC5940Servo.h" #include "Servo.h" TLC5940Servo tlc(p5, p7, p8, p9, p21); Servo serv(); int main() { // Enable the first LED tlc[5] = 0xFFF; int val = 0; int sw = 0; while (1) { switch (sw) { case 0: tlc[5] = 0x0fff; break; case 1: tlc[5] = 0x0f8f; break; case 2: tlc[5] = 0x0f0f; break; } sw = (sw + 1) % 3; printf("%d\n\r", tlc[5]); wait(1.0); } /*while(1) { if (sw){ tlc[5] = val++; if (val >= 0x0FFF) sw = 0; } else { tlc[5] = val--; if (val <= 0) sw = 1; } printf("%d\n\r", val); wait(0.01); }*/ } // write 203 307 409 for -40, 0, +40 degrees