Fa2018-es200-1121-proj2-Clang&Bang / Mbed 2 deprecated Project2motor

Dependencies:   Motor mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "Motor.h"
00003 
00004 Motor m(p25,p27,p28); 
00005 DigitalIn switch1(p18);
00006 DigitalIn switch2(p19);
00007 float speed=0.0;
00008 
00009 int main() {
00010     while(1){
00011     if (switch1==1 && switch2 == 0) {
00012         m.speed(speed); //the speed equals
00013         speed = 1.0; 
00014         printf("Let's get this bread\n\r"); }
00015     else if (switch2==1 && switch1 == 0) {
00016         m.speed(speed);
00017         speed = -1.0;
00018         printf("Let's get this bread in reverse\n\r"); }
00019     else if (switch1==1 && switch2==1) {
00020         m.speed(speed);
00021         speed = 0.0;
00022         printf("BEEP BOOP BOP BEEP DOES NOT COMPUTE\n\r"); }
00023         
00024     else (switch1 == 0 && switch2==0);{
00025         m.speed(speed);
00026         speed = 0.0;
00027         printf("BEEP BOOP BOP BEEP DOES NOT COMPUTE\n\r");  }
00028         
00029         
00030         }
00031 }
00032     
00033 
00034 
00035 
00036 
00037 
00038 
00039