Presentation code for PROJECT #1 - ES200 Fall 2014
Dependencies: Servo mbed Motor
ARM/armmain.cpp
- Committer:
- cstab94
- Date:
- 2014-10-09
- Revision:
- 2:f10d71467f13
File content as of revision 2:f10d71467f13:
//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; } } }