David Cho
/
blood_pressure_monitor
4180
main.cpp@0:f80f6460d556, 2019-04-15 (annotated)
- Committer:
- davidcho23
- Date:
- Mon Apr 15 18:23:54 2019 +0000
- Revision:
- 0:f80f6460d556
first
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
davidcho23 | 0:f80f6460d556 | 1 | #include "mbed.h" |
davidcho23 | 0:f80f6460d556 | 2 | |
davidcho23 | 0:f80f6460d556 | 3 | DigitalOut myled(LED1); |
davidcho23 | 0:f80f6460d556 | 4 | |
davidcho23 | 0:f80f6460d556 | 5 | |
davidcho23 | 0:f80f6460d556 | 6 | |
davidcho23 | 0:f80f6460d556 | 7 | void printReadings(void const *args) { |
davidcho23 | 0:f80f6460d556 | 8 | while(1) { |
davidcho23 | 0:f80f6460d556 | 9 | LCD.lock(); |
davidcho23 | 0:f80f6460d556 | 10 | uLCD.locate(0,1); |
davidcho23 | 0:f80f6460d556 | 11 | uLCD.printf(cur_data); |
davidcho23 | 0:f80f6460d556 | 12 | uLCD.locate(0,3); |
davidcho23 | 0:f80f6460d556 | 13 | for (int i = 0; i < 10; i++) { |
davidcho23 | 0:f80f6460d556 | 14 | uLCD.printf(signal[i]); |
davidcho23 | 0:f80f6460d556 | 15 | uLCD.printf(" "); |
davidcho23 | 0:f80f6460d556 | 16 | } |
davidcho23 | 0:f80f6460d556 | 17 | LCD.unlock(); |
davidcho23 | 0:f80f6460d556 | 18 | } |
davidcho23 | 0:f80f6460d556 | 19 | } |
davidcho23 | 0:f80f6460d556 | 20 | |
davidcho23 | 0:f80f6460d556 | 21 | int main() { |
davidcho23 | 0:f80f6460d556 | 22 | uLCD.cls(); |
davidcho23 | 0:f80f6460d556 | 23 | uLCD.printf("Change baudrate......"); |
davidcho23 | 0:f80f6460d556 | 24 | uLCD.baudrate(3000000); //jack up baud rate to max |
davidcho23 | 0:f80f6460d556 | 25 | uLCD.background_color(BLACK); |
davidcho23 | 0:f80f6460d556 | 26 | uLCD.cls(); |
davidcho23 | 0:f80f6460d556 | 27 | uLCD.color(WHITE); |
davidcho23 | 0:f80f6460d556 | 28 | uLCD.text_height(2); |
davidcho23 | 0:f80f6460d556 | 29 | uLCD.text_width(2); |
davidcho23 | 0:f80f6460d556 | 30 | |
davidcho23 | 0:f80f6460d556 | 31 | Thread thread1(readSensor); |
davidcho23 | 0:f80f6460d556 | 32 | Thread thread2(changeValve); |
davidcho23 | 0:f80f6460d556 | 33 | Thread thread3(printLCD); |
davidcho23 | 0:f80f6460d556 | 34 | |
davidcho23 | 0:f80f6460d556 | 35 | while(1) { |
davidcho23 | 0:f80f6460d556 | 36 | myled = 1; |
davidcho23 | 0:f80f6460d556 | 37 | wait(0.2); |
davidcho23 | 0:f80f6460d556 | 38 | myled = 0; |
davidcho23 | 0:f80f6460d556 | 39 | wait(0.2); |
davidcho23 | 0:f80f6460d556 | 40 | } |
davidcho23 | 0:f80f6460d556 | 41 | } |