
Transmit pressure/temperature reading once per hour from xDot to iupivot server
Dependencies: ATParser MPL3115A2 mbed
main.cpp@0:50820e1648aa, 2018-04-03 (annotated)
- Committer:
- csinders
- Date:
- Tue Apr 03 14:44:59 2018 +0000
- Revision:
- 0:50820e1648aa
- Child:
- 1:b672c24629d5
Created lab10;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
csinders | 0:50820e1648aa | 1 | #include "mbed.h" |
csinders | 0:50820e1648aa | 2 | #include "MPL3115A2.h" |
csinders | 0:50820e1648aa | 3 | |
csinders | 0:50820e1648aa | 4 | MPL3115A2 pressure_sensor(PB_7,PB_6,0x60); |
csinders | 0:50820e1648aa | 5 | |
csinders | 0:50820e1648aa | 6 | Serial pc(SERIAL_TX, SERIAL_RX, 115200); |
csinders | 0:50820e1648aa | 7 | Serial device(PA_9, PA_10, 115200); // tx, rx |
csinders | 0:50820e1648aa | 8 | |
csinders | 0:50820e1648aa | 9 | DigitalOut myled(LED1); |
csinders | 0:50820e1648aa | 10 | int main() { |
csinders | 0:50820e1648aa | 11 | //Try to connect xDot to network |
csinders | 0:50820e1648aa | 12 | while(1) { |
csinders | 0:50820e1648aa | 13 | if(pc.readable()) { |
csinders | 0:50820e1648aa | 14 | device.putc(pc.getc()); |
csinders | 0:50820e1648aa | 15 | myled = !myled; |
csinders | 0:50820e1648aa | 16 | } |
csinders | 0:50820e1648aa | 17 | if(device.readable()) { |
csinders | 0:50820e1648aa | 18 | pc.putc(device.getc()); |
csinders | 0:50820e1648aa | 19 | myled = !myled; |
csinders | 0:50820e1648aa | 20 | } |
csinders | 0:50820e1648aa | 21 | } |
csinders | 0:50820e1648aa | 22 | } |