Lluis Nadal
/
ER400TRS_Temperature_Receiver
Wireless temperature receiver with ER400TRS transceiver.
main.cpp@0:996e5de63519, 2011-08-31 (annotated)
- Committer:
- lnadal
- Date:
- Wed Aug 31 04:09:10 2011 +0000
- Revision:
- 0:996e5de63519
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lnadal | 0:996e5de63519 | 1 | |
lnadal | 0:996e5de63519 | 2 | /* |
lnadal | 0:996e5de63519 | 3 | ************************************************************************** |
lnadal | 0:996e5de63519 | 4 | Wireless temperature receiver with ER400TRS transceiver. |
lnadal | 0:996e5de63519 | 5 | 433 MHz transceiver. 180 bytes of data. 19200 Baud. |
lnadal | 0:996e5de63519 | 6 | |
lnadal | 0:996e5de63519 | 7 | |
lnadal | 0:996e5de63519 | 8 | Wiring: |
lnadal | 0:996e5de63519 | 9 | p1: antenna(17 cm). p2,p7(Host Ready Input), p9: ground. |
lnadal | 0:996e5de63519 | 10 | p5(Serial Data Out): mBed's p10(rx).p6(Serial Data In), p8: Vcc = +5 V. |
lnadal | 0:996e5de63519 | 11 | |
lnadal | 0:996e5de63519 | 12 | Author: Lluis Nadal. August 2011. |
lnadal | 0:996e5de63519 | 13 | ************************************************************************** |
lnadal | 0:996e5de63519 | 14 | */ |
lnadal | 0:996e5de63519 | 15 | |
lnadal | 0:996e5de63519 | 16 | #include "mbed.h" |
lnadal | 0:996e5de63519 | 17 | |
lnadal | 0:996e5de63519 | 18 | |
lnadal | 0:996e5de63519 | 19 | Serial pc(USBTX, USBRX); // tx, rx |
lnadal | 0:996e5de63519 | 20 | Serial receiver(p9, p10); // tx, rx |
lnadal | 0:996e5de63519 | 21 | char s[10]; |
lnadal | 0:996e5de63519 | 22 | |
lnadal | 0:996e5de63519 | 23 | |
lnadal | 0:996e5de63519 | 24 | int main() { |
lnadal | 0:996e5de63519 | 25 | |
lnadal | 0:996e5de63519 | 26 | |
lnadal | 0:996e5de63519 | 27 | wait(2); |
lnadal | 0:996e5de63519 | 28 | receiver.baud(19200); |
lnadal | 0:996e5de63519 | 29 | wait(0.5); |
lnadal | 0:996e5de63519 | 30 | |
lnadal | 0:996e5de63519 | 31 | while (1) { |
lnadal | 0:996e5de63519 | 32 | if (receiver.readable()) { |
lnadal | 0:996e5de63519 | 33 | receiver.scanf("%s",s); |
lnadal | 0:996e5de63519 | 34 | |
lnadal | 0:996e5de63519 | 35 | pc.printf( "%s C\r\n",s); |
lnadal | 0:996e5de63519 | 36 | } |
lnadal | 0:996e5de63519 | 37 | |
lnadal | 0:996e5de63519 | 38 | } |
lnadal | 0:996e5de63519 | 39 | } |
lnadal | 0:996e5de63519 | 40 | |
lnadal | 0:996e5de63519 | 41 |