asd
/
4180lab02_servo
Revision 0:153d4d641769, committed 2017-03-01
- Comitter:
- jderemer3
- Date:
- Wed Mar 01 16:48:56 2017 +0000
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Wed Mar 01 16:48:56 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/simon/code/Servo/#36b69a7ced07
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 01 16:48:56 2017 +0000 @@ -0,0 +1,31 @@ +// Hello World to sweep a servo through its full range + +#include "mbed.h" +#include "Servo.h" + +Servo myservo(p22); + +int main() { + int s = 0; + while (1) + { + if (s = 0) + { + for(float p=0; p<1.0; p += 0.1) + { + myservo = p; + wait(0.4); + } + s = 1; + } + else if (s = 1) + { + for(float p=1; p>0.0; p -= 0.1) + { + myservo = p; + wait(0.4); + } + s = 0; + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 01 16:48:56 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/176b8275d35d \ No newline at end of file