Hello!
I would like your advice for an Arduino project.
I am building a little robot that can move on the floor (either forward-backward in x direction, or laterally in y direction, but never turn).
It moves inside a rectangular floor, with walls on the sides.
The robot has 2 distance sensors around it (front, right), measuring the distance to 2 walls.
On my computer, I would like to plot the position of the robot in real time, on the screen of my computer (top view): one small rectangle (the robot) moving inside one big rectangle (the floor)
(Just 2 rectangles at the beginning of the project. After that, I'd like to add more complex objects in the plot, like wheels, bumpers, images, etc.)
But I have no idea how to get the measures immediately on the computer (in real-time) and use them to plot this.
I know Serial.print() , I use it quite often to check the sensor values. But I don't really know how to do "more" with those values.
I thought about something like:
- send, at some frequency (like every 0.5 s, so 2 Hz), the 2 sensor measures to my computer
- have them written in some file
- write an independent Python program to plot read the file and plot the rectangles in real-time
although I don't really know how to do it. And I don't know if it would be the most effective way to do it.
Can I ask you for some help on this, please? Would there be a "classical" way to do this? Some projects I could have a look on?
Thanks!