![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
s
main.cpp@0:259c3f9d6fd3, 2016-05-04 (annotated)
- Committer:
- yanay_amir
- Date:
- Wed May 04 15:09:45 2016 +0000
- Revision:
- 0:259c3f9d6fd3
s
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yanay_amir | 0:259c3f9d6fd3 | 1 | #include "mbed.h" |
yanay_amir | 0:259c3f9d6fd3 | 2 | Serial RN42(p9, p10); |
yanay_amir | 0:259c3f9d6fd3 | 3 | Serial pc(USBTX,USBRX); |
yanay_amir | 0:259c3f9d6fd3 | 4 | DigitalOut RN42_led(LED1); |
yanay_amir | 0:259c3f9d6fd3 | 5 | DigitalOut pc_led(LED2); |
yanay_amir | 0:259c3f9d6fd3 | 6 | DigitalIn joycenter(p14); |
yanay_amir | 0:259c3f9d6fd3 | 7 | InterruptIn obj(p14); |
yanay_amir | 0:259c3f9d6fd3 | 8 | void joy() |
yanay_amir | 0:259c3f9d6fd3 | 9 | { |
yanay_amir | 0:259c3f9d6fd3 | 10 | wait_ms(25); |
yanay_amir | 0:259c3f9d6fd3 | 11 | if(joycenter) |
yanay_amir | 0:259c3f9d6fd3 | 12 | { |
yanay_amir | 0:259c3f9d6fd3 | 13 | pc.printf("$$$\r\n"); |
yanay_amir | 0:259c3f9d6fd3 | 14 | if(RN42.readable()) |
yanay_amir | 0:259c3f9d6fd3 | 15 | { |
yanay_amir | 0:259c3f9d6fd3 | 16 | while(RN42.getc() != '\n'){} |
yanay_amir | 0:259c3f9d6fd3 | 17 | } |
yanay_amir | 0:259c3f9d6fd3 | 18 | pc.printf("r,1\r\n"); |
yanay_amir | 0:259c3f9d6fd3 | 19 | } |
yanay_amir | 0:259c3f9d6fd3 | 20 | |
yanay_amir | 0:259c3f9d6fd3 | 21 | } |
yanay_amir | 0:259c3f9d6fd3 | 22 | int main() { |
yanay_amir | 0:259c3f9d6fd3 | 23 | |
yanay_amir | 0:259c3f9d6fd3 | 24 | RN42.baud(115200); |
yanay_amir | 0:259c3f9d6fd3 | 25 | pc.baud(115200); |
yanay_amir | 0:259c3f9d6fd3 | 26 | pc.printf("Ready\n"); |
yanay_amir | 0:259c3f9d6fd3 | 27 | obj.rise(&joy); |
yanay_amir | 0:259c3f9d6fd3 | 28 | joycenter.mode (PullDown); |
yanay_amir | 0:259c3f9d6fd3 | 29 | while(1) |
yanay_amir | 0:259c3f9d6fd3 | 30 | { |
yanay_amir | 0:259c3f9d6fd3 | 31 | |
yanay_amir | 0:259c3f9d6fd3 | 32 | } |
yanay_amir | 0:259c3f9d6fd3 | 33 | } |