... | ... | @@ -141,6 +141,9 @@ while (true) { |
|
|
```
|
|
|
##### Fig. 11 - the mapping between the sensors and the motors.
|
|
|
|
|
|
The power to the motor is controlled by the motorPowerLeft and motorPowerRight variables which are determined by the readings from the light and ultrasonic sensors. To only get readings between 0 and 100 from the ultrasonic sensor we divide the readings by 255 and multiply by 100. In order to give the ultrasonic sensor less priority than the light sensor, the total value is divided by 4 and in turn subtracted by 25 to make the readings high when its close to an object and low otherwise.
|
|
|
We observed the robot having trouble moving because it received too low motor power, therefore we added a scale value to increase the overall motor power.
|
|
|
|
|
|
When using the mapping as seen in fig. 10. (above) we learned that the robot has a behaviour of moving towards objects and stop. This was because of the inhibitory connection between the ultrasonic sensor and the robot. The motor in the same side as the ultrasonic sensor would move slower as the distance to an object got smaller.
|
|
|
|
|
|
[![image alt text](http://img.youtube.com/vi/kWPPdGhtCJ0/0.jpg)](http://www.youtube.com/watch?v=kWPPdGhtCJ0)
|
... | ... | |