lab4

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

main.cpp

Committer:
sim91
Date:
2015-03-27
Revision:
4:403b2f7060c4
Parent:
3:8bef7af1ba84

File content as of revision 4:403b2f7060c4:

#include "head.h"

void start();
void forward(void const *args);
void steering(void const *args);
void obstacle(void const *args);

int main(void)
{
    start();
    
    while(timer);
    
    Thread thread1(steering);
    Thread thread2(obstacle);
    Thread thread3(forward);

    while (1) {
        stdio_mutex.lock();
        int wait=450*force;
        lcd.locate(13,0);
        lcd.printf("%d",--count);

        Thread::wait(600-wait);
        if(count==0) {
            lcd.cls();
            lcd.locate(1,8);
            lcd.printf("Congrats You win!");
            exit(0);
        }
        stdio_mutex.unlock();
    }
}