Take the card bricks from your Junkbot kit and build a base for your robot.
Or, you can make your own design using whatever you want.
We’re going to build obstacle avoider robot using ultrasonic sensor which avoids obstacles or drives itself not running into an obstacle and finds itself a safer path.
Take the card bricks from your Junkbot kit and build a base for your robot.
Or, you can make your own design using whatever you want.
Take DC Motors and the ultrasonic and connect them to junkbot board as shown in the below figure. Connect the Dc motors to the motors pins in the board. Connect ultrasonic sensor using the plug and play four pin connector to pins no 6 and 7 (B1).
How to write to code to measure the distance and display using code bricks and upload it to Arduino.
1. Open Junkbot software.
2. Click on the robots and drag .
3. To read the values of ultrasonic use brick from the robots.
4. This brick actually helps to set different kind of distance like 5cm, 10cm,15cm say if you want your robot to stop or turn less than 10cm before the obstacle use the brick as illustrated .
5. So if the distance between your robot and the obstacle is less than 10cm then robot turn else it
will move in forward direction to follow this statement we use brick from control.
6. Now to make your robot moving forward, connect all the blocks above as shown .
and to turn .
Code brick program