WIFi
Dependencies: WiflyInterface mbed
main.cpp@0:cfdce53ce25b, 2014-10-09 (annotated)
- Committer:
- mayu_hori
- Date:
- Thu Oct 09 22:53:43 2014 +0000
- Revision:
- 0:cfdce53ce25b
Wifi:; Version 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mayu_hori | 0:cfdce53ce25b | 1 | #include "mbed.h" |
mayu_hori | 0:cfdce53ce25b | 2 | #include "WiflyInterface.h" |
mayu_hori | 0:cfdce53ce25b | 3 | |
mayu_hori | 0:cfdce53ce25b | 4 | |
mayu_hori | 0:cfdce53ce25b | 5 | |
mayu_hori | 0:cfdce53ce25b | 6 | Serial pc(USBTX, USBRX); |
mayu_hori | 0:cfdce53ce25b | 7 | |
mayu_hori | 0:cfdce53ce25b | 8 | /* wifly object where: |
mayu_hori | 0:cfdce53ce25b | 9 | * - p9 and p10 are for the serial communication |
mayu_hori | 0:cfdce53ce25b | 10 | * - p25 is for the reset pin |
mayu_hori | 0:cfdce53ce25b | 11 | * - p26 is for the connection status |
mayu_hori | 0:cfdce53ce25b | 12 | * - "mbed" is the ssid of the network |
mayu_hori | 0:cfdce53ce25b | 13 | * - "password" is the password |
mayu_hori | 0:cfdce53ce25b | 14 | * - WPA, WEP_128 or NONE is the security CAMBIAR EL WIFLY.H |
mayu_hori | 0:cfdce53ce25b | 15 | */ |
mayu_hori | 0:cfdce53ce25b | 16 | // |
mayu_hori | 0:cfdce53ce25b | 17 | |
mayu_hori | 0:cfdce53ce25b | 18 | WiflyInterface wifly(D1, D0, D2, D3, "iPhone de Mayumi", "vs8uykp08iro", WPA) ; //WiflyInterface( PinName tx, PinName rx, PinName reset, PinName tcp_status,const char * ssid, const char * phrase, Security sec) |
mayu_hori | 0:cfdce53ce25b | 19 | // mbed Application Board |
mayu_hori | 0:cfdce53ce25b | 20 | //WiflyInterface wifly(p9, p10, p30, p29, "mbed", "password", WPA); |
mayu_hori | 0:cfdce53ce25b | 21 | |
mayu_hori | 0:cfdce53ce25b | 22 | int main() { |
mayu_hori | 0:cfdce53ce25b | 23 | wifly.init(); // use DHCP |
mayu_hori | 0:cfdce53ce25b | 24 | while (!wifly.connect()); // join the network |
mayu_hori | 0:cfdce53ce25b | 25 | printf("IP Address is %s\n\r", wifly.getIPAddress()); |
mayu_hori | 0:cfdce53ce25b | 26 | wifly.disconnect(); |
mayu_hori | 0:cfdce53ce25b | 27 | } |