![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ECE 4180 Final Project
Dependencies: mbed PulseSensor mbed-rtos LSM9DS1_Library_cal
main.cpp@3:0393f97fd8cf, 2015-04-27 (annotated)
- Committer:
- mbedAustin
- Date:
- Mon Apr 27 21:23:36 2015 +0000
- Revision:
- 3:0393f97fd8cf
- Parent:
- 2:a8dcb07a1d00
- Child:
- 4:ba9100d52e48
changed serial -> raw serial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedAustin | 0:59bec1fd956e | 1 | #include "mbed.h" |
mbedAustin | 2:a8dcb07a1d00 | 2 | |
mbedAustin | 3:0393f97fd8cf | 3 | RawSerial pc(USBTX, USBRX); // computer to mbed board |
mbedAustin | 3:0393f97fd8cf | 4 | RawSerial esp(D1, D0); // mbed board to target board |
mbedAustin | 2:a8dcb07a1d00 | 5 | |
mbedAustin | 2:a8dcb07a1d00 | 6 | int |
mbedAustin | 2:a8dcb07a1d00 | 7 | main() |
mbedAustin | 2:a8dcb07a1d00 | 8 | { |
mbedAustin | 2:a8dcb07a1d00 | 9 | pc.baud(115200); |
mbedAustin | 3:0393f97fd8cf | 10 | esp.baud(115200); |
mbedAustin | 2:a8dcb07a1d00 | 11 | wait(0.1); |
mbedAustin | 2:a8dcb07a1d00 | 12 | pc.printf("\r\n########### ready ###########\r\n"); |
mbedAustin | 2:a8dcb07a1d00 | 13 | esp.printf("AT+RST\r\n"); |
mbedAustin | 2:a8dcb07a1d00 | 14 | while(1) { |
mbedAustin | 2:a8dcb07a1d00 | 15 | if(pc.readable()) { |
mbedAustin | 2:a8dcb07a1d00 | 16 | char c = pc.getc(); |
mbedAustin | 2:a8dcb07a1d00 | 17 | //pc.putc(c); // echo character back to computer for sanity |
mbedAustin | 2:a8dcb07a1d00 | 18 | //if(c == '\r'){ |
mbedAustin | 2:a8dcb07a1d00 | 19 | // esp.printf("\r\n"); |
mbedAustin | 2:a8dcb07a1d00 | 20 | // } |
mbedAustin | 2:a8dcb07a1d00 | 21 | // else{ |
mbedAustin | 2:a8dcb07a1d00 | 22 | esp.putc(c); |
mbedAustin | 2:a8dcb07a1d00 | 23 | // } |
mbedAustin | 2:a8dcb07a1d00 | 24 | } |
mbedAustin | 2:a8dcb07a1d00 | 25 | if(esp.readable()) { |
mbedAustin | 2:a8dcb07a1d00 | 26 | char c = esp.getc(); |
mbedAustin | 2:a8dcb07a1d00 | 27 | //if(c == '\n'){ |
mbedAustin | 2:a8dcb07a1d00 | 28 | // pc.printf("\\n"); |
mbedAustin | 2:a8dcb07a1d00 | 29 | // } |
mbedAustin | 2:a8dcb07a1d00 | 30 | // if(c == '\r'){ |
mbedAustin | 2:a8dcb07a1d00 | 31 | // pc.printf("\\r"); |
mbedAustin | 2:a8dcb07a1d00 | 32 | // } |
mbedAustin | 2:a8dcb07a1d00 | 33 | |
mbedAustin | 2:a8dcb07a1d00 | 34 | pc.putc(c); |
mbedAustin | 2:a8dcb07a1d00 | 35 | } |
mbedAustin | 0:59bec1fd956e | 36 | } |
mbedAustin | 0:59bec1fd956e | 37 | } |