Program is a work in progress
Dependencies: 4DGL-uLCD-SE PinDetect SDFileSystem mbed-rtos mbed wave_player
Fork of 4180_Lab4_v6 by
Diff: main.cpp
- Revision:
- 1:e84085bbf399
- Parent:
- 0:9f1095365b9a
--- a/main.cpp Sat Oct 29 22:15:03 2016 +0000 +++ b/main.cpp Sun Oct 30 04:39:01 2016 +0000 @@ -7,6 +7,8 @@ #include "Speaker.h" #include "wave_player.h" #include "SDFileSystem.h" + + BusOut mbedleds(LED1,LED2,LED3,LED4); Robot myRobot; Nav_Switch myNav( p21, p22, p23, p24, p25); @@ -14,6 +16,8 @@ AnalogOut DACout(p18); // used to play sound on speaker wave_player waver(&DACout); SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card setup + + //Wiring Set-up: //Speaker: p18 //SD Card: DO=p6,SCK=p7,DI=p5,CS=p8,VCC=Vout,GND=GND @@ -150,6 +154,27 @@ while(1) { mbedleds = ~(myNav & 0x0F); //update leds with nav switch direction inputs if(myNav.fire()) mbedleds = 0x0F; + + // Player Movement checked with navigation switch + if (myNav.left() ) + { + myRobot.moveLeft(); + } + + if (myNav.right()) + { + myRobot.moveRight(); + } + + if (myNav.up()) + { + myRobot.moveForward(); + } + + if (myNav.down()) + { + myRobot.moveBackward(); + } Thread::wait(50); } } @@ -169,7 +194,7 @@ } myRobot.drawFrog(); - Thread thread1(AutoPilot_thread); + //Thread thread1(AutoPilot_thread); Thread thread2(Location_thread); Thread thread3(ThumbStick_thread); Thread thread4(SFX_thread);