with ultrasonic sensor, it reads the distance, but as I guess it takes some time to read. If I read the distance in while(1) loop, the program glitches as I need other sensors to give me information very fast. The ultrasonic sensor slows the execution. How can I handle this? May be use ultrasonic in different thread or something else.. pls help (C language by the way)
how about an interrupt for that? so the other program can just resume till the reding is finished and then in the ISR you can fetch the data
Thread that continuously reads the sensor and updates a shared resource. The main program retrieves the value from the shared memory. Also pipes
One thing is that Rpi don't have a dedicated clock to keep time (at least till v3 or so). It is better to interface with an Arduino or custom board to the Rpi for such time sensitive applications and calculations. The Arduino can do the timing clock and Rpi can do the math.
Обсуждают сегодня