ES305H Lanier Turchan
/
MBED_lab1_Step5
step 5
Revision 0:68ec2377b85c, committed 2014-09-04
- Comitter:
- LanierUSNA16
- Date:
- Thu Sep 04 03:06:21 2014 +0000
- Commit message:
- step 5;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Thu Sep 04 03:06:21 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/Servo/#36b69a7ced07
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 04 03:06:21 2014 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" +#include "servo.h" +//Lab 2, step 5 + +//code given by professor +Serial pc(USBTX, USBRX); + +//establish pwm out on pin 21 +PwmOut servo1(p21); +//establish analogin on pin 15 +AnalogIn ain(p15); + +int main() + {//begin main + + //create float variable where the voltage input can be stored + float signal = 0.0; + + while (1) + {//begin while + //set computer sampling rate + pc.baud(921600); + //assign input voltage to the variable 'signal' + signal = ain; + + //set servo position to the value of 'signal' the input voltage + servo1.write(signal); + + wait(1); + + }//end while + + + }//end main \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 04 03:06:21 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013 \ No newline at end of file