GeoLocation
This example sketch queries the freegeoip.net service to get the local approximate geographic location based on IP address.Combined with code in the ntpTest or InternetTime sketches, this can give absolute position and time, extremely useful for seasonal calculations like sun position, insolation, day length, etc. One could always add a GPS module or just plug in values from your GPS or phone, but for applications where extreme accuracy isn't required, this has the luxury of coming 'free' with the CC3000 already in use.
Before you run the sketch, edit it to replace the dummy SSID and password with your own:
#define WLAN_SSID "yourNetwork" // cannot be longer than 32 characters! #define WLAN_PASS "yourPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2 #define WLAN_SECURITY WLAN_SEC_WPA2
Hello, CC3000! Free RAM: 837 Initializing...OK. Connecting to network...Started AP/SSID scan Connecting to Turlingdrome...Waiting to connect...connected! Requesting address from DHCP server...OK IP Addr: 192.168.0.4 Netmask: 255.255.255.0 Gateway: 192.168.0.1 DHCPsrv: 192.168.0.1 DNSserv: 192.168.0.1 Getting server IP address...192.151.154.154 Connecting to geo server... Connect to 192.151.154.154:80 connected. Requesting data... Reading response...OK Disconnecting RESULTS: Country: United States Region: California City: Richmond Longitude: -122.35 Latitude: 37.94