G2C Click Example.
Description
This example shows the device capability of connecting to the cloud and updating the sensor data on the cloud and receiving data from actuators.
The demo application is composed of two sections :
Application Init
Initializes the driver, restarts the device, and after that tests the communication by sending "AT" command.
Application Task
Application task is split in few stages:
- G2C_CONNECT_TO_NETWORK: Sends commands to configure device to connect to the specified network.
- G2C_CONNECT_TO_CLOUD: Sends commands to configure device to connect to the specified device on the cloud.
- G2C_EXAMPLE: This function executes example which updates sensor data on the cloud and displays all data received from the module (ex. the actuator switch state change received from the cloud).
Additional Function
- static void g2c_clear_app_buf ( void )
- static err_t g2c_process ( void )
- static void g2c_error_check( err_t error_flag )
- static void g2c_log_app_buf ( void )
- static err_t g2c_rsp_check ( uint8_t *rsp )
- static err_t g2c_connect_to_network( void )
- static err_t g2c_connect_to_cloud( void )
- static err_t g2c_example( void )
- Note
- In order for the example to work, user needs to set the WiFi credentials and the cloud device parameters. Enter valid values for the following macros: WIFI_SSID, WIFI_PASS, DEVICE_KEY, DEVICE_PASSWORD, DEVICE_SENSOR_REF. Example: WIFI_SSID "MikroE Public" WIFI_PASS "mikroe.guest" DEVICE_KEY "xxxxxxxxxxxxxxxx" DEVICE_PASSWORD "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" DEVICE_SENSOR_REF "TEMP_SEN_R"
DEVICE_KEY and DEVICE_PASSWORD strings should match the device credentials which were generated during the Click Cloud device creation step. DEVICE_SENSOR_REF is expected to be a reference to a temperature sensor with a data range from -20 to +80 degrees Celsius. For more information about the registration on the Click Cloud and creating the device refer to the following user guide: https://download.mikroe.com/documents/click-cloud/guide-to-click-cloud.pdf
- Author
- Stefan Filipovic