Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE Motor PinDetect SDFileSystem mbed-rtos mbed wave_player
Fork of 4180_Lab4_v6 by
Revision 3:427c365950d7, committed 2016-11-02
- Comitter:
- swilliams346
- Date:
- Wed Nov 02 17:17:03 2016 +0000
- Parent:
- 2:68c4e1539da5
- Commit message:
- Beta Version
Changed in this revision
diff -r 68c4e1539da5 -r 427c365950d7 Motor.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motor.lib Wed Nov 02 17:17:03 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/simon/code/Motor/#f265e441bcd9
diff -r 68c4e1539da5 -r 427c365950d7 Robot.h
--- a/Robot.h Mon Oct 31 20:52:10 2016 +0000
+++ b/Robot.h Wed Nov 02 17:17:03 2016 +0000
@@ -30,19 +30,22 @@
void drawRoad(int Xp,int Yp) {
uLCD.filled_rectangle(Xp-10,Yp-10,Xp+10,Yp+10,BLACK);
- uLCD.filled_rectangle(Xp-2,Yp-1,Xp+2,Yp+1,WHITE);
+ uLCD.line(Xp-11, Yp+1 , Xp+11, Yp+1, WHITE);
+ uLCD.line(Xp-11, Yp-1 , Xp+11, Yp-1, WHITE);
}
void drawCar1(int Position1, int CarWidth) {
- //stdio_mutex.lock();
+ uLCD.filled_rectangle(Position1-CarWidth-1,90,Position1-CarWidth-3,100,BLACK);
+ uLCD.line(Position1-CarWidth-1, 95+1 , Position1-CarWidth-4, 95+1, WHITE);
+ uLCD.line(Position1-CarWidth-1, 95-1 , Position1-CarWidth-4, 95-1, WHITE);
uLCD.filled_rectangle(Position1-CarWidth,95-4,Position1+CarWidth,95+4,BLUE);
- //stdio_mutex.unlock();
}
void drawCar2(int Position2, int CarWidth) {
- //stdio_mutex.lock();
- uLCD.filled_rectangle(Position2-CarWidth,52-4,Position2+CarWidth,52+4,RED);
- //stdio_mutex.unlock();
+ uLCD.filled_rectangle(Position2+CarWidth+1,48,Position2+CarWidth+3,58,BLACK);
+ uLCD.line(Position2+CarWidth+1, 53+1 , Position2+CarWidth+4, 53+1, WHITE);
+ uLCD.line(Position2+CarWidth+1, 53-1 , Position2+CarWidth+4, 53-1, WHITE);
+ uLCD.filled_rectangle(Position2-CarWidth,48,Position2+CarWidth,56,RED);
}
void drawWater(int Xp,int Yp) {
diff -r 68c4e1539da5 -r 427c365950d7 main.cpp
--- a/main.cpp Mon Oct 31 20:52:10 2016 +0000
+++ b/main.cpp Wed Nov 02 17:17:03 2016 +0000
@@ -69,19 +69,19 @@
stdio_mutex.lock();
myRobot.drawDrown1();
stdio_mutex.unlock();
- Thread::wait(50);
+ Thread::wait(150);
stdio_mutex.lock();
myRobot.drawDrown2();
stdio_mutex.unlock();
- Thread::wait(50);
+ Thread::wait(150);
stdio_mutex.lock();
myRobot.drawDrown3();
stdio_mutex.unlock();
- Thread::wait(50);
+ Thread::wait(150);
stdio_mutex.lock();
myRobot.drawDrown4();
stdio_mutex.unlock();
- Thread::wait(50);
+ Thread::wait(150);
stdio_mutex.lock();
myRobot.drawDrown5();
stdio_mutex.unlock();
@@ -131,8 +131,8 @@
stdio_mutex.unlock();
*/
stdio_mutex.lock();
- myRobot.drawRoad(Column1-10,95);
- myRobot.drawRoad(Column1-31,95);
+ //myRobot.drawRoad(Column1-10,95);
+ //myRobot.drawRoad(Column1-31,95);
myRobot.drawCar1(Position1,CarWidth);
stdio_mutex.unlock();
Thread::wait(10);
@@ -143,7 +143,7 @@
{
while(Alive) {
Position2 = Position2 - Rate1;
- if(Position2 < 0 ){
+ if(Position2 < -12 ){
Position2 = 140;
}
@@ -157,11 +157,11 @@
}
Column2 = (ceil((Position2 - CarWidth)/21))*21;
stdio_mutex.lock();
- myRobot.drawRoad(Column2+10,53);
- myRobot.drawRoad(Column2+31,53);
+ //myRobot.drawRoad(Column2+10,53);
+ //myRobot.drawRoad(Column2+31,53);
myRobot.drawCar2(Position2,CarWidth);
stdio_mutex.unlock();
- Thread::wait(35);
+ Thread::wait(30);
}
}
@@ -176,10 +176,10 @@
}
if(Drown == 1){
- stdio_mutex.lock();
- uLCD.locate(1,1);
- uLCD.printf("SPLASH!");
- stdio_mutex.unlock();
+ //stdio_mutex.lock();
+ //uLCD.locate(1,1);
+ //uLCD.printf("SPLASH!");
+ //stdio_mutex.unlock();
FILE *wave_file;
wave_file=fopen("/sd/Splash.wav","r");
