final

Dependencies:   Servo1 mbed

Fork of ES200_Project2_1 by Project 2

main.cpp

Committer:
m211656
Date:
2018-10-11
Revision:
0:b6a454c0b00a
Child:
1:852f86d263c8

File content as of revision 0:b6a454c0b00a:

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

Servo myservo(p21);
Servo myservo2(p22);
Motor m(p26,p30,p29);
DigitalIn sw1=(p16), sw2=(p17), sw3=(p18), sw4=(p19), sw5=(p20);
BusOut lights(p5,p6,p7,p8,p9);


int main()
{
    while(1) 
    {
        if(sw1==1) {
            lights=1;
            //myservo motor on
        }
        if(sw2==1) {
            lights=3;
            //m turns on
            }
        if(sw3==1) {
            lights=7;
            //myservo2 on
            }
        if(sw4==1) {
            lights=0xF;
            //dc motor off
            }
        if(sw5==1) {
            lights=0x1F;//wrong hex number?----need 11111 in hex
            //servo motor off, all lights on
            }
        else {
            lights=0;} //no switches on = no lights on
        
    }
}