10/15/14 code

Dependencies:   Servo mbed

main.cpp

Committer:
alphasig
Date:
2014-10-15
Revision:
0:fbe913f85d70

File content as of revision 0:fbe913f85d70:

#include "mbed.h"
#include "Servo.h"

Servo myservo1(p21);
Servo myservo2(p22);


DigitalIn sw1(p16);
DigitalIn sw2(p17);
DigitalIn sw3(p18);
DigitalIn sw4(p19);

int switch1=sw1;
int switch2=sw2;
int switch3=sw3;
int switch4=sw4;

int main() {
    
    float servopos;
    
    while (switch1==1)
    {
        while (servopos <=.6)
        {
            myservo1= servopos;
            servopos=servopos +.005;
            wait(.01);
            }
            while (servopos >=.3)
            {
            myservo1=servopos;
            servopos=servopos-.005;
            wait(.01);
            }
            }
            }