In this example, we show the procedure for sending static data to our platform using Adafruit Ethernet FeatherWing.
Table of Contents
1.0 Adafruit Ethernet FeatherWing Overview
An overview of the Adafruit Ethernet FeatherWing can be viewed for technical description of this micro-controller.
2.1 The Ethernet switch
Uncomment the appropriate switch in the UCW_Config.h file
2.2 The Config file
Edit the the config.h file by un-commenting the lines below and providing necessary information.
You are expected to provide the MAC address of the Ethernet shield. Static IP address can also be used if the dynamic allocation of IP address is unavailable.
The MAC address and IP address should be of data type byte and IPAddress respectively.
2.3 Device ID and Data stream name
These variables are used to uniquely identify the device and sensor data transmitted our platform. The deviceID is generated by the UCW platform and also serves as a form of the device identification.
2.4 The connect method
This method is called in the setup() section of the sketch code. It initializes the Ethernet module. The MAC address is used to start Ethernet connection. If DHCP fails, the static IP address provided is used.
2.5 Printing network information
The printNetworkInfo() method displays relevant information of the connected network and displays same on the serial monitor.
2.6 The sys method
The sys method reconfirms that the connection to our server is still active, and if lost, re-establishes connection. This is done in the loop() section of the sketch code.
2.7 The readData method
In this example, we sent a fixed data, a JSON string, to send to our server
2.8 The sendData method
This method takes three string parameters: device ID, datastream name, and payload. In this example, we used DEVICE_ID, DATA_STREAM and data as parameters for the sendData method
The full example can be found here.