Presentation code for PROJECT #1 - ES200 Fall 2014
Dependencies: Servo mbed Motor
Diff: ARM/armmain.cpp
- Revision:
- 3:c4a0c4532571
- Parent:
- 2:f10d71467f13
- Child:
- 4:0ed46a6cdf66
--- a/ARM/armmain.cpp Thu Oct 09 19:16:54 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -//Code for the arm servo -//Created 09 OCT 14, 3/C Stabler -#include "mbed.h" -#include "Servo.h" - -Servo arm(p21); -DigitalIn switch1(p16); -DigitalIn switch2(p17); - -int main(){ - - float armpos; - int sw1; - int sw2; - - while(1){ - sw1 = switch1.read(); - sw2 = switch2.read(); - - if(sw1 == 1) - { - for(armpos = 0.0; armpos <= 1.0; armpos += .05){ - arm = armpos; - wait(.1); - } - } - else if(sw1 == 0) - { - arm = armpos; - } - else if(sw2 == 1) - { - for(armpos = 0.0; armpos >= 0.0; armpos -= .05){ - arm = armpos; - wait(.1); - } - } - else if(sw2 == 0) - { - arm = armpos; - } - } -} \ No newline at end of file