NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
CC3100 Get Weather Application
Contents
Overview and application details[edit]
This sample application demonstrates how to connect to openweathermap.org server and request for weather details of a city. The application opens a TCP socket w/ the server and sends a HTTP Get request to get the weather details. The received data is processed and displayed on the console
Note: This wiki page is only applicable for CC3100-SDK v1.0.0 and upward releases. For documentation on older SDKs' examples, refer corresponding file in <cc3100-sdk-installation-location>\cc3100-sdk\docs\examples\'
Source Files briefly explained[edit]
i. main - Initializes the device, connects to an AP, opens a TCP socket, requests and displays the weather information.
Usage[edit]
Prerequisite: This application requires an access-point with internet connectivity
- Connect the board to a Windows-PC and configure the terminal-program for seeing the logs - CC3100 & CC3200 Terminal Setting has detailed instructions for configuring the terminal-program
- From openweathermap.org create an API Key and modify the 'API Key' value in main.c found below:
#define POST_BUFFER "&mode=xml&units=imperial&APPID=<API KEY> HTTP/1.1\r\nHost:api.openweathermap.org\r\nAccept: */"
- Edit sl_common.h and modify the values of below macros for the device to connect to the AP
#define SSID_NAME "<ap_name>" #define SEC_TYPE SL_SEC_TYPE_OPEN #define PASSKEY ""
- Edit below parameters in main.c for getting the weather information from server:
#define CITY_NAME "<city>"
- Build and launch the application
- See the self explanatory logs on the terminal-program's console.
- The application connects to the weather-server and opens an TCP socket to communicate w/ it.
- It receives and processes the weather-information and displays it on the console
- On success, below message will be displayed on the terminal
Limitations/Known Issues[edit]
None
Links[edit]
{{#invoke: Navbox | navbox }} {{#invoke: Navbox | navbox }}