Hello world for the TLC5940Servo library.
Dependencies: TLC5940Servo mbed
main.cpp@1:aeb0ed70cbd0, 2014-10-21 (annotated)
- Committer:
- dudanian
- Date:
- Tue Oct 21 06:05:45 2014 +0000
- Revision:
- 1:aeb0ed70cbd0
- Parent:
- 0:0b054b47ac3d
- Child:
- 2:faa25eaa18dd
Changed code to cycle through servo settings.
Who changed what in which revision?
User | Revision | Line number | New 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 | 1:aeb0ed70cbd0 | 9 | tlc.calibrate(5, 0.0006, 40.0); |
dudanian | 0:0b054b47ac3d | 10 | while (1) { |
dudanian | 1:aeb0ed70cbd0 | 11 | for (float i = 0.0; i < 1.0; i += 0.05) { |
dudanian | 1:aeb0ed70cbd0 | 12 | tlc[5] = i; // assigning |
dudanian | 1:aeb0ed70cbd0 | 13 | printf("%f\n\r", tlc[5]); // reading |
dudanian | 1:aeb0ed70cbd0 | 14 | wait (0.1); |
dudanian | 0:0b054b47ac3d | 15 | } |
dudanian | 0:0b054b47ac3d | 16 | wait(1.0); |
dudanian | 0:0b054b47ac3d | 17 | } |
dudanian | 1:aeb0ed70cbd0 | 18 | } |