Bolt receiving wrong data from arduino

When you serialprint from arduino, the data is put on serial monitor.

(Here serial monitor is a 2 way communication channel, like a whatsapp chat. Only difference is, its a notepad where values are written.)

When the data is printed on serial monitor, you can use serialRead to take the already present in the monitor(sent by arduino) and use that information for performing something.

Do you understand about serial communication now?

Not really a little bit so bolt module take values from the one printed on serial moniter so if I delay printing on serial moniter we are slowing down pushing of data to bolt module correct me if I’m wrong

Yes, it is also dependent on the serialRead on bolt’s side.

Hey one more problem I observed is when I exit infinite while loop by pressing Ctrl + c and again run it …it starts from the point I stopped so the delay is increasing how to avoid that

What I want is bolt to take values when it turned on but not before that

If your arduino keeps pushing data to the serial monitor, bolt will pick up the value one by one, from the point of time your bolt was switched on and your arduino’s loop was ran.

Declare a variable int A = 0 and do a serial.println(A++); Then run the python, exit the loop. Again run the python, exit the loop. You will see how it functions.

At this point, you have to use your own algorithms based on the type of project you want to build.

There are many projects on the internet related to serial communication.

Ok my bad got it as soon as Arduino turns on Bolt also turns on I forget about that

Can you suggest how can I trigger BOLT with arduino.i tried a lot by doing it from BOLT end and I couldn’t decrease the delay.

Don’t bother about the delay. We don’t use wifi modules for constantly reading these kinds of data. exhausts the API, in the case of Bolt.

So can you suggest any change in my project what I want is to use Bolt to send message through telegram when object is less than 40 cm away can u suggest what to do.

Are you aware of software serial communication?

Forget it. Do something like this,

if(distance<=40)
{
digitalWrite(LED6,HIGH);
digitalWrite(LED5,HIGH);
digitalWrite(LED4,HIGH);
digitalWrite(LED3,HIGH);
digitalWrite(LED2,HIGH);
digitalWrite(LED1,HIGH);
tone(BUZ,3000);

Serial.println(distance);
}

In python program, directly take sensor_value str(data[‘value’]) to print something like “Object is (sensor value) cm near. Sending a message on telegram”, and send the following data through telegram as well.

I want you to write the logic yourself. Take your time and give your code a trial. We face many bugs, but it’s important to keep up with the process of trying.

hey can i do something like this …i want bolt to get readings from the point i run the script not from the point BOLT turned on
in other words i want arduino to start pushing data from the point when i start running python script but not the readings before that

and btw what is RD\r command?

This command is used along with processPushDataCommand(), when you use the Bolt Cloud to log the data. For example any graph or table chart.

You mean bolt will be connected to the arduino the whole time, even if the python script is not running?

yeah i mean do we need to connect bolt iot after running python script?

No, you have to run python after your connections are done. It will anyways initiate the communication when serialBegin is initiated. Without that, bolt shouldn’t be able to receive any data

but i didnt use serial begin anywhere in my script

In the above post see I didn’t use serial begin any where

You mean this script right? Because you just changed Begin --> Read in the above script.

I am not sure what initiated the communication, but you weren’t receiving the correct data without initialization.