wheelchair code for driver assitance

Dependencies:   mbed

Fork of wheelchairalexa by ryan lin

main.cpp

Committer:
ryanlin97
Date:
2018-07-17
Revision:
5:e0ccaab3959a
Parent:
3:a5e71bfdb492
Child:
6:0cd57bdd8fbc

File content as of revision 5:e0ccaab3959a:

#include "wheelchair.h"

AnalogIn x(A0);
AnalogIn y(A1);

DigitalOut off(D0);
DigitalOut on(D1);
DigitalOut up(D2);
DigitalOut down(D3);

Wheelchair smart(xDir,yDir);

int main(void)
{
    on = 1;
    while(1){
 /*   if( pc.readable()) {
        char c = pc.getc();
        if( c == 'w') {
            pc.printf("up \n");
            smart.forward(); 
            }
        
        else if( c == 'd') {
            pc.printf("left \n");
            smart.left();
            }
        
        else if( c == 'a') {
            pc.printf("right \n");
            smart.right();
            }
        
        else if( c == 's') {
            pc.printf("down \n");
            smart.backward();
            }
        
        else {
            pc.printf("none \n");
            smart.stop();
            if( c == 'o') {
               pc.printf("turning on");
               on = 0;
               wait(process);
               on = 1; 
                }
            
            else if( c == 'k') {
                off = 0;
                wait(process);
                off = 1;
                }
        
            else if( c == 'u') {
                up = 0;
                wait(process);
                up = 1;
                }
        
            else if( c == 'p') {
                down = 0;
                wait(process);
                down = 1;
                }
            }
           }
           
    else {
       pc.printf("Nothing pressed \n");
       smart.stop();
            }
   */
    smart.move(x,y); 
    wait(process);
       }

}