Im trying to get values from my Arduino to get sent to the Bolt cloud and my python server .
I succesfully managed to read the commands sent by bolt on the serial monitor in Arduino
The monitor correctly shows the moisture value as follows and detects the Bolt RD command
In the serialRead function, you don’t need to pass the pin number. But you have to pass the number of characters that you want to read from the incoming UART data.
i tried removing the sensor_value = int(data[‘value’]) and replaced it with str
the error seemed to be solved but there was no value displayed
the output was
"Sensor value is : " @rahul.singh1 how do i solve this , iv been constantly posting on this forum for more than a month to get this to work , please try n support me through this , would really appreciate it !
@rahul.singh1@vinayak.joshi , im aware that im depending alot on your replies but iv really tried alot and i still cant get this to work , i can just make any simple project to get certified , but i really want to make something worth sharing with a slight level of complexity , not just for the sake of a certificate .
Would really appreciate it if i could get some kind of active support , just till i can get atleast 1 sensor value to read
It seems you have included the library for the BoltIoT-Arduino-Helper, but you seem to have used the commands wrongly. Since you have accessed the Serial object, which you also passed to boltiot.begin(Serial), the print statements in your code are interfering with the communication with the Bolt WiFi module.
Also, by using the readData variable to read data from the serial object into this variable, you are making sure that the Boltiot object does not get the RD\r command. So calling the processPushDataCommand is completely useless.
Please go through the following codes to understand how you have to use the library commands.
You just have to change what is returned by the pushData function in the above code, and it should work for you.
Also, remember that you SHOULD NOT use the Serial variable if you are using the library, as this may interfere with the communictaion.
@vinayak.joshi , thank you for your reply .
I have made the suggested changes and used the format above to refactor the code ,
This is how it looks now
But now the serial monitor shows garbage values when i Push data to cloud …
I would really like it if you could make the changes to the code yourself and put it here to avoid further delay of results .
Thank you again for your reply
What baud rate have you set for your Serial terminal?
The issue you are mentioning comes in if you have set the baud rate on the terminal to something other than 9600. Based on the amount of data you are getting, I would say, you have set it to higher than 9600.
I have not been able to test this myself, as I am not certain which version of the Arduino IDE you are using. But another person was facing a similar issue and this helped.