This program calculate location of Wi-Fi receiver, by using AP beacon. Please check the Japanese magazine "Interface 2012/12".

Dependencies:   TextLCD mbed

Committer:
nakata
Date:
Fri Aug 24 03:21:43 2012 +0000
Revision:
0:4eaf38ccb19c
CQ test version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nakata 0:4eaf38ccb19c 1 #include "mbed.h"
nakata 0:4eaf38ccb19c 2 #include "TextLCD.h"
nakata 0:4eaf38ccb19c 3
nakata 0:4eaf38ccb19c 4 TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7
nakata 0:4eaf38ccb19c 5
nakata 0:4eaf38ccb19c 6 DigitalOut myled1(LED1);
nakata 0:4eaf38ccb19c 7 DigitalOut myled2(LED2);
nakata 0:4eaf38ccb19c 8 DigitalOut myled3(LED3);
nakata 0:4eaf38ccb19c 9 DigitalOut myled4(LED4);
nakata 0:4eaf38ccb19c 10
nakata 0:4eaf38ccb19c 11 #include "WiFiScanner.h"
nakata 0:4eaf38ccb19c 12 #include "LocationHandler.h"
nakata 0:4eaf38ccb19c 13
nakata 0:4eaf38ccb19c 14 int main() {
nakata 0:4eaf38ccb19c 15 WiFiScanner *wifiScanner = new WiFiScanner();
nakata 0:4eaf38ccb19c 16 lcd.printf("Start configuration.");
nakata 0:4eaf38ccb19c 17
nakata 0:4eaf38ccb19c 18 wifiScanner->reset();
nakata 0:4eaf38ccb19c 19 wifiScanner->serialInit();
nakata 0:4eaf38ccb19c 20
nakata 0:4eaf38ccb19c 21 lcd.cls();
nakata 0:4eaf38ccb19c 22 lcd.printf("baud rate matched.");
nakata 0:4eaf38ccb19c 23
nakata 0:4eaf38ccb19c 24 wifiScanner->waitStartup();
nakata 0:4eaf38ccb19c 25
nakata 0:4eaf38ccb19c 26 lcd.cls();
nakata 0:4eaf38ccb19c 27 lcd.printf("TMD3591AD ready.");
nakata 0:4eaf38ccb19c 28 wifiScanner->scanMode();
nakata 0:4eaf38ccb19c 29
nakata 0:4eaf38ccb19c 30 lcd.cls();
nakata 0:4eaf38ccb19c 31 lcd.printf("start scan");
nakata 0:4eaf38ccb19c 32 while (true) {
nakata 0:4eaf38ccb19c 33 int i;
nakata 0:4eaf38ccb19c 34 myled1 = 1;
nakata 0:4eaf38ccb19c 35 myled2 = 1;
nakata 0:4eaf38ccb19c 36 myled3 = 1;
nakata 0:4eaf38ccb19c 37 myled4 = 1;
nakata 0:4eaf38ccb19c 38 wifiScanner->doScan();
nakata 0:4eaf38ccb19c 39 LocationManagerCalcPos(apinfo_count, apinfos);
nakata 0:4eaf38ccb19c 40 for ( i = 1; i <= 5; i++ ) {
nakata 0:4eaf38ccb19c 41 myled1 = (i >>3) & 1;
nakata 0:4eaf38ccb19c 42 myled2 = (i >>2) & 1;
nakata 0:4eaf38ccb19c 43 myled3 = (i >>1) & 1;
nakata 0:4eaf38ccb19c 44 myled4 = i & 1;
nakata 0:4eaf38ccb19c 45 wait(1.0);
nakata 0:4eaf38ccb19c 46 }
nakata 0:4eaf38ccb19c 47
nakata 0:4eaf38ccb19c 48 }
nakata 0:4eaf38ccb19c 49 }
nakata 0:4eaf38ccb19c 50