Go Down

Topic: Examples (Read 341 times) previous topic - next topic

endorama

Oct 10, 2018, 03:24 pm Last Edit: Oct 10, 2018, 03:39 pm by endorama
As the documentation is short on this ( the only available is the inline docs in the Cloud UI ), please post here useful example of sketches.

I'm going to pin this to increase visibility. Mod please add examples behind this line




An example (fake) thermostat View
Showcase usage of callbacks

ballscrewbob

Thanks !
That is exactly the sort of thing we need.
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Sun_Wuk0ng

#2
Feb 08, 2019, 03:54 pm Last Edit: Feb 17, 2019, 03:36 pm by Sun_Wuk0ng Reason: The Sketch with a HDC1080 sensor, changed to a Grove BME280.
I haven't found an example of how to send data to the cloud. The example here LevelSensor.ino at least gives me an idea of how it could work. Can someone show me how to update my two variables Room_Temp and Room_Humidity using the corresponding on_X_Change() functions?
With this sketch I want to send the data read out by a BME280, temperature and relative humidity, into the cloud.

mbanzi

It's very simple :)

In the main loop() whenever you change the value of the Room_Temp or Room_Humidity variables their values is automatically sent to the cloud. that's it

If the properties are read-write , when to cloud changes one of the values the corresponding on_X_Change() function is called. inside that function place some code that does something with the new value.

 Room_Temp or Room_Humidity ideally should be read-only values because they are read from sensors and sent to the cloud. read-write properties are used when you want a value that both the device and the cloud can change.
Let us know if you need more info

Sun_Wuk0ng

Thank you very much for the prompt answer.

But then I don't understand why the error message "No data yet received" is displayed in the cloud, for the value of Room_Temp. For the value of Room_Humidity no error is displayed, but no value is output. During a local test the sensor data were read out. Maybe I made a mistake, I will check everything again.

Sun_Wuk0ng

My MKR1010 suddenly had no connection to my IoT WLAN access point. So far this position on the desk was not obstructive. But at an elevated place, on a TFT monitor everything works. It's really that simple!

albertian

@Sun_Wuk0ng i'm happy to see that you made it work! Just to be clear: when you see the label No data yet received on a widget in your Thing's dashboard it means that - since you added that particular property - your board didn't make it to connect to the cloud with the new code generated for that property (for example because it couldn't connect to wifi).
Once you upload the sketch to the board, I suggest you to open the Serial Monitor (just click on the Monitor tab on the left) to see the info about the connection state. In fact, the cloud sketch prints there information and errors about the state of the connection to wifi and to the cloud itself.

mastrolinux

Another full tutorial available here:
Arduno IoT Cloud Getting Started

Go Up