cristicsordas / raspi_robot

0 stars 0 forks source link

Python application for moving the robot using source of light #8

Closed cristicsordas closed 1 year ago

cristicsordas commented 1 year ago

Write a python application which evaluates the responses from the PCF8591 controller. Depending on the values of the light sensors the application must decide in which direction to move the raspi robot. The control of the motor is done by sending messages to the PCA9685 controller. DoD: Start the python application. Move a brighter source of light in front of the robot(e.g. light from the smartphone ) . The robot should start to move.

cristicsordas commented 1 year ago

the implementation was done here : 466f9d60d8e2f68b575520bd21c565fa522b8fc4

Started the application. The logging shows that the sensor reported the value 63. In this case it started to move the car by sending the pwm value 3000 to the PCA9685 controller Here is part of the logging:

open device /dev/pcf8591 pcf channel read 4 bytes. data 8 56:0:0:0 value1 56 read 4 bytes. data 31:0:0:0 value2 31 read 4 bytes. data < 60:0:0:0 value1 60 read 4 bytes. data 31:0:0:0 value2 31 read 4 bytes. data 31:0:0:0 value1 31 read 4 bytes. data 31:0:0:0 value2 31 result 0 31 data received. length: 4 open device /dev/pcf8591 pcf channel read 4 bytes. data ? 63:0:0:0 value1 63 read 4 bytes. data ? 63:0:0:0 value2 63 result 0 63 data received. length: 26 open device /dev/pca9685 i2c write addr 1 value 4 i2c write addr 0 value 1 read reg addr 0 reg read nr bytes 4 value 1 i2c write addr 0 value 1 motor model duty 3000 3000 0 0 set pwm channel direction 0 duty 3000 set pwm channel direction 1 duty 3000 set pwm channel direction 0 duty 0 data received. length: 4 open device /dev/pcf8591