asdf

Dependencies:   Motor Servo mbed

Committer:
TheDoctor822
Date:
Mon Apr 18 01:38:19 2016 +0000
Revision:
0:38e54cab2a6e
Lab 7 part 2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TheDoctor822 0:38e54cab2a6e 1 /************************************************************************************
TheDoctor822 0:38e54cab2a6e 2 Lab 07 - Part 1
TheDoctor822 0:38e54cab2a6e 3 This program takes in an integer and three float values from the user. It uses
TheDoctor822 0:38e54cab2a6e 4 the integer as a start trigger and increments the lights on the mbed to match
TheDoctor822 0:38e54cab2a6e 5 the float values by increments of 0.01.
TheDoctor822 0:38e54cab2a6e 6 MIDN 3/C Drew Moore
TheDoctor822 0:38e54cab2a6e 7 24 FEB 2016
TheDoctor822 0:38e54cab2a6e 8 ***********************************************************************************/
TheDoctor822 0:38e54cab2a6e 9
TheDoctor822 0:38e54cab2a6e 10
TheDoctor822 0:38e54cab2a6e 11 #include "mbed.h"
TheDoctor822 0:38e54cab2a6e 12 #include "Motor.h"
TheDoctor822 0:38e54cab2a6e 13 #include "Servo.h"
TheDoctor822 0:38e54cab2a6e 14
TheDoctor822 0:38e54cab2a6e 15 Serial pc(USBTX, USBRX); // tx, rx
TheDoctor822 0:38e54cab2a6e 16
TheDoctor822 0:38e54cab2a6e 17 Servo myservo( p21 );
TheDoctor822 0:38e54cab2a6e 18
TheDoctor822 0:38e54cab2a6e 19 int main() {
TheDoctor822 0:38e54cab2a6e 20
TheDoctor822 0:38e54cab2a6e 21 myservo.calibrate( .0009, 90 );
TheDoctor822 0:38e54cab2a6e 22
TheDoctor822 0:38e54cab2a6e 23
TheDoctor822 0:38e54cab2a6e 24 while(1) {
TheDoctor822 0:38e54cab2a6e 25
TheDoctor822 0:38e54cab2a6e 26 myservo = 0;
TheDoctor822 0:38e54cab2a6e 27
TheDoctor822 0:38e54cab2a6e 28 for ( float i = 0; i < 1.0; i += 0.0555 ) {
TheDoctor822 0:38e54cab2a6e 29
TheDoctor822 0:38e54cab2a6e 30 myservo = i;
TheDoctor822 0:38e54cab2a6e 31 wait( .2 );
TheDoctor822 0:38e54cab2a6e 32 }
TheDoctor822 0:38e54cab2a6e 33 }
TheDoctor822 0:38e54cab2a6e 34 }
TheDoctor822 0:38e54cab2a6e 35