lab4

Dependencies:   4DGL-uLCD-SE mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "head.h"
00002 
00003 void start();
00004 void forward(void const *args);
00005 void steering(void const *args);
00006 void obstacle(void const *args);
00007 
00008 int main(void)
00009 {
00010     start();
00011     
00012     while(timer);
00013     
00014     Thread thread1(steering);
00015     Thread thread2(obstacle);
00016     Thread thread3(forward);
00017 
00018     while (1) {
00019         stdio_mutex.lock();
00020         int wait=450*force;
00021         lcd.locate(13,0);
00022         lcd.printf("%d",--count);
00023 
00024         Thread::wait(600-wait);
00025         if(count==0) {
00026             lcd.cls();
00027             lcd.locate(1,8);
00028             lcd.printf("Congrats You win!");
00029             exit(0);
00030         }
00031         stdio_mutex.unlock();
00032     }
00033 }