When you are retrieving data from a ThingSpeak channel you have many options and formats to choose from. We wanted to highlight a few options that are easily overlooked.
Let’s say you have an Arduino and you want to get the last value in a channel. You could get your feed and then write some parsing code to extract the data that you are looking for. It’s a waste of code space and also fills your finite buffers on your microcontroller. Let the cloud do the work and give you just the value you are looking for.
Here’s how you would get our light levels: Live Demo
Modifying the response
You can even add data to the response. Maybe you have Twilio reading back your temperature. It would not be much fun if Twillio says to you, “80”. Sensor data without context is noise!
Here are two optional parameters when returning the last data on a ThingSpeak Channel:
- prepend=[text to add before the API response]
- append=[text to add after the API response]
Check out the ThingSpeak Documentation for more information.