I want to send ( or simulate temperature readings ) from the smartphone to Bluemix.
Going thru the tutorial https://evothings.com/evothings-does-mqtt-with-bluemix/ and I found it is doing some publish.
How do I post a temperature in "json" format ?
The temperature will be something like 20, 24, 31, and so on.
Appreciate if you could help with a SAMPLE line.
=== Cut and Paste === from your app.js ===
setupCanvas () {
...
var msg = JSON.stringify({from: app.pos, to: {x:x, y:y}, color: app.color}) << == what would it be for temperature which is an integer.
app.publish(msg);
..
}
==X== Done Cut and paste ===X==
Simulating temperature readings from Smartphone to Bluemix
-
- Posts: 12
- Joined: 09:35, 14 Feb 2016
Re: Simulating temperature readings from Smartphone to Bluemix
Hi!
I'd use something like Micke's example to simulate data from a SensorTag:
You can find the entire example here, it's for Parse but you'll get the idea
https://evothings.com/how-to-make-a-mobile-iot-app-for-the-facebook-parse-data-cloud/
I'd use something like Micke's example to simulate data from a SensorTag:
Code: Select all
function initialiseSimulationTimer()
{
// Timer that updates temperature values.
setInterval(function() {
lastTemperatureReading = ((Math.random() * 5) + 20).toFixed(2)
},
5000)
// Timer that sends data to the cloud.
setInterval(onTemperatureTimer, 5000)
}
You can find the entire example here, it's for Parse but you'll get the idea
https://evothings.com/how-to-make-a-mobile-iot-app-for-the-facebook-parse-data-cloud/
Return to “Questions and answers”
Who is online
Users browsing this forum: No registered users and 46 guests