4180

Dependencies:   mbed

main.cpp

Committer:
davidcho23
Date:
2019-04-15
Revision:
0:f80f6460d556

File content as of revision 0:f80f6460d556:

#include "mbed.h"

DigitalOut myled(LED1);



void printReadings(void const *args) {
    while(1) {
        LCD.lock();
        uLCD.locate(0,1);
        uLCD.printf(cur_data);
        uLCD.locate(0,3);
        for (int i = 0; i < 10; i++) {
            uLCD.printf(signal[i]);
            uLCD.printf(" ");
        }
        LCD.unlock();
    }    
}

int main() {
    uLCD.cls();
    uLCD.printf("Change baudrate......");
    uLCD.baudrate(3000000); //jack up baud rate to max
    uLCD.background_color(BLACK);
    uLCD.cls();
    uLCD.color(WHITE);
    uLCD.text_height(2);
    uLCD.text_width(2);
    
    Thread thread1(readSensor);
    Thread thread2(changeValve);
    Thread thread3(printLCD);
    
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}