coding for the sub

Dependencies:   mbed Motor Servo

main.cpp

Committer:
m211734
Date:
2018-10-12
Revision:
5:9825fb56de59
Parent:
4:6feb04db3086
Child:
7:2a445f634f19

File content as of revision 5:9825fb56de59:

#include "mbed.h"
#include "stdio.h"
#include "stdlib.h"
#include "Motor.h"
#include "Servo.h"
/* this is the code for the sub
*/


#include "mbed.h"
#include "stdio.h"
#include "Motor.h"

DigitalIn sw(p20);
Motor m(p26,p30,p29);

int main(){
    while(1){
    sw.read();
if (sw==1)
{
    printf("motor on");
    m.speed(0.5);
}
else{
    printf("motor off");
m.speed(0.0);
}
wait(0.1);
}
}