Hello world for the TLC5940Servo library.

Dependencies:   TLC5940Servo mbed

Committer:
dudanian
Date:
Tue Oct 21 15:06:20 2014 +0000
Revision:
3:ad4dfe34cfcd
Parent:
2:faa25eaa18dd
Removed indexed calibrate to make usage more like indexing an array of mbed official Servos

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dudanian 0:0b054b47ac3d 1 #include "mbed.h"
dudanian 0:0b054b47ac3d 2 #include "TLC5940Servo.h"
dudanian 0:0b054b47ac3d 3
dudanian 0:0b054b47ac3d 4 TLC5940Servo tlc(p5, p7, p8, p9, p21);
dudanian 0:0b054b47ac3d 5
dudanian 0:0b054b47ac3d 6 int main()
dudanian 0:0b054b47ac3d 7 {
dudanian 1:aeb0ed70cbd0 8 // Calibrate the 5th motor
dudanian 3:ad4dfe34cfcd 9 tlc[5].calibrate(0.0006, 40.0);
dudanian 0:0b054b47ac3d 10 while (1) {
dudanian 3:ad4dfe34cfcd 11 for (float i = 0.0; i <= 1.01; i += 0.05) {
dudanian 1:aeb0ed70cbd0 12 tlc[5] = i; // assigning
dudanian 3:ad4dfe34cfcd 13 printf("%f\n\r", (float)tlc[5]); // reading
dudanian 1:aeb0ed70cbd0 14 wait (0.1);
dudanian 0:0b054b47ac3d 15 }
dudanian 2:faa25eaa18dd 16 wait(0.5);
dudanian 2:faa25eaa18dd 17 tlc[5] = 0.0;
dudanian 2:faa25eaa18dd 18 wait(0.5);
dudanian 0:0b054b47ac3d 19 }
dudanian 1:aeb0ed70cbd0 20 }