Wifi module configuration for GR_Peach
Dependencies: mbed
Wifi.cpp@0:7d24b78f9a5e, 2016-12-06 (annotated)
- Committer:
- RahulSitaram
- Date:
- Tue Dec 06 05:13:39 2016 +0000
- Revision:
- 0:7d24b78f9a5e
- Child:
- 1:e5ef21ebff5f
Wifi_1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RahulSitaram | 0:7d24b78f9a5e | 1 | #include "mbed.h" |
RahulSitaram | 0:7d24b78f9a5e | 2 | |
RahulSitaram | 0:7d24b78f9a5e | 3 | DigitalOut led1(LED1); |
RahulSitaram | 0:7d24b78f9a5e | 4 | DigitalOut led2(LED2); |
RahulSitaram | 0:7d24b78f9a5e | 5 | uint8_t data; |
RahulSitaram | 0:7d24b78f9a5e | 6 | uint8_t wifi_ack; |
RahulSitaram | 0:7d24b78f9a5e | 7 | Serial pc(USBTX, USBRX); |
RahulSitaram | 0:7d24b78f9a5e | 8 | Serial Wifi(P2_14,P2_15); |
RahulSitaram | 0:7d24b78f9a5e | 9 | |
RahulSitaram | 0:7d24b78f9a5e | 10 | void call() { |
RahulSitaram | 0:7d24b78f9a5e | 11 | // Note: you need to actually read from the serial to clear the RX interrupt |
RahulSitaram | 0:7d24b78f9a5e | 12 | data = pc.getc(); |
RahulSitaram | 0:7d24b78f9a5e | 13 | printf("%c\n", data); |
RahulSitaram | 0:7d24b78f9a5e | 14 | led2 = !led2; |
RahulSitaram | 0:7d24b78f9a5e | 15 | } |
RahulSitaram | 0:7d24b78f9a5e | 16 | |
RahulSitaram | 0:7d24b78f9a5e | 17 | int main() { |
RahulSitaram | 0:7d24b78f9a5e | 18 | |
RahulSitaram | 0:7d24b78f9a5e | 19 | //pc.attach(&call); |
RahulSitaram | 0:7d24b78f9a5e | 20 | Wifi.baud(9600); |
RahulSitaram | 0:7d24b78f9a5e | 21 | Wifi.printf("AT"); |
RahulSitaram | 0:7d24b78f9a5e | 22 | wifi_ack = Wifi.getc(); |
RahulSitaram | 0:7d24b78f9a5e | 23 | pc.printf("%s\n", wifi_ack); |
RahulSitaram | 0:7d24b78f9a5e | 24 | } |