Project using Arduino

Hi @askumar835,

Check this link https://docs.boltiot.com/docs/read-incoming-serial-data. serialRead takes the ‘till’ parameter as an argument.

boltobject.serialRead(2) - it means read-only two characters from the incoming UART data.
serialRead(10) - It means read-only 10 characters from the incoming UART data.

So you can use as many sensors as you want. While doing the serial write, insert a comma or any other delimiter between each value.

For example:
Suppose the value of sensor A is 10 and the value of sensor B is 20
You can write “10, 20” to the serialWrite.

While doing the serialRead,

You can do (python code)

response = bolt.serialRead(10) // You are reading first 10 charters of incoming uart data. 
// the value of response will be 
// {"success": "1", "value": "10, 20"}
//Now we need only the value from the response, 

data = json.loads(response)
data_value = data["value"]
// Here data_value is "10, 20"
Now we know each sensor value is separated by a comma. 
data_value = data_value.split(',')
// ['10', ' 20']
sensor_A = data_value[0]
//10
sensor_B = data_value[1]
//20

Now you have both the sensor value in different variables.

There is no difference between serialRead('10') and serialRead(10). Bolt python library handles both cases.

Do let me know in case you need any other information.

@akshayphadke002 Sure, it will be awesome.