Toy Car

by swimmingdrew03 in Workshop > 3D Printing

74 Views, 0 Favorites, 0 Comments

Toy Car

IMG_2432.jpg

These instructions will be used to create a Toy car with the ability to move forward and create sound and light.

Supplies

To start you will need the two halves of the car that is the top and bottom, the axles and wheels, the cpx, and the three wires to connect it to a battery, and a computer to create the code.

Lets Make the Body

First, we want to make the car one piece, start by gluing the top to the bottom making sure it is properly aligned.

in this step, we may as well finish the body as well. take the two axles and put one axle through the two holes where the front and back wheels would be after which glue to wheels to each end of the axle.

Coding the CPX

code.png

we will start with the basics of the code.

for this project, you will need the libraries - Bus device, circuitplayground, and motor.

make sure your cpx is properly plugged in so when it's saved it works.

Importing the Libraries

import.png

so that all the code can properly run and to help in the making process we will import the libraries first.

by typing the code within the image you have successfully imported all the libraries needed to run the code.

Two Button Setup

while true.png

For our car we use the two buttons on the CPX both have the same function but allow for the pressing of a different button to still get the same result.


for this, we will use a while true loop

Shine Bright

light 1.png
light 2.png

next, we will add lights to the CPX

these will be red and blue to mimic that of a police car.

the first image defines the base setting for our lights.

the second image will play either red or blue lights depending on their respective button



Lets Make Some Noise

tone.png

Now we will get our cpx playing a tone while it moves

these will play a tone on button press


FORWARD!

throttle 2.png
throttle.png
final product.png

adding this code will allow your car to move forward for 5 seconds

now that you are done with the code press save and unplug the cpx from your computer

WIRING

IMG_2435.jpg
IMG_7345.jpg

When wiring you have three wires for this case they will be red yellow and brown

make sure before connecting the wires to the cpx you run them through the hole on the bottom

Brown - the ground wire

yellow - the function

red - the output


these correspond to the words on the CPX itself

after this is done you may now place the cpx on the top of the car and the motor under or on the back.

Gotta Go Fast

now we have to glue the motor to the bottom of the car making sure it touches the ground (if the wheel attached does touch the ground the car will not move) be careful not to place the motor the wrong way or you might end up going backwards.