[Kids Project] Simple RC Car
Contents
Make things
Let’s make a simple RC car with an obniz and two DC Motors.
Materials
- obniz Board
- power supply for obniz
- DC Motor and gearbox x2
- RC car tire x2
- wood or plastic for RC car foundation
How to make
Body
First, build gearbox and motor. You can buy it at Toy Stores.
And fix it on the foundation like wood or plastic. It will be good that you make the foundation to fix an obniz and the battery.
Hardware connection
Connect DC Motors to the obniz Board like the table and the image below by referring to DC Motor Library. Please adjust the direction of the DC Motors properly, because rotation direction depends on the DC Motors’ direction.
obniz | DC Motor |
---|---|
0 | [left DC Motor] OUT1 |
1 | [left DC Motor] OUT2 |
2 | [right DC Motor] OUT2 |
3 | [right DC Motor] OUT1 |
Supply power to the obniz and run the program below. Then, you can control the direction and the rotation of the RC car tires from operation screen like the image below.
Software
To make motors rotate if you press the button, use .on() function of jQuery.
Detect if the buttons are pressed or not like below.
$("#lf").on('touchstart mousedown', ()=>{ motorA.move(true); }); $("#lf").on('touchend mouseup',()=>{ motorA.stop(); });