Project If Then That School Project Jim Van Paassen Gdsn

by sunny deltoro in Circuits > Arduino

191 Views, 0 Favorites, 0 Comments

Project If Then That School Project Jim Van Paassen Gdsn

20210531_211458[1].jpg

The machine I made was inspired by the war games that I often played
with my friends, one of the things we would always have a lot of trouble with was rotating the tanks as there wasn't an easy way to track how many degrees the turret could rotate and at what angle a tanks armor could be penetrated. Therefor I made a machine that serves two functions. The first is that it is able to track how many degrees the turret is able to rotate per turn (in this case 15 degrees.) it then saves the azimuth that the turret for that tank is at and remembers it for when it's that players turn again. Then the player would look from the turret to see if they are able to hit an enemy, if they can, they go into the second function.

The second function is that it is able to calculate how much damage the targeted tank takes from the point at which they are being fired at by rotating the turret to the tank that is shooting at them (there was going to be another servo used to turn the hull to make the process easier, but I sadly couldn't implement it.) I only had the ability to make one functioning tank, so the other pieces of the board are represented by tokens until it's their turn to take an action.

First Iteration

first itteration.png

My first iteration of the project if then that was rather poor as it was essentially just a sensor that could detect whether the water level got too low.

Second Itteration

second itteration.png

The teachers told me that the project should include something that you
couldn't do with normal electronics. So in essence data should flow from the censors to the program and data should flow from the program to the circuit. In this case there wasn't a traditional censor instead the user would have to look if the servo is lined up with its target and feed that information back into the program. This is also the iteration where I came up with the idea for a sort of board game using tanks.

What I Learned

20210530_220916[1].jpg

The biggest things I learned were:
how to operate a 3d printer how to make a circuit that doesn't burn down

how to solder a circuit together

and how to send date from processing into the Arduino program. As I had never done these things before. I had the biggest trouble with the 3D printer as when I measured the pieces that would have to fit inside I didn't count on the plastic shrinking over time and I have to file down and reprint a lot of the pieces because of it.

I am also disappointed with how the Arduino and processing programs turned out, as I was only able to send a single char from processing over to the Arduino, which made me have to write some spaghetti code in order to bypass that limitation.

The Circuit

circuit.png

pin 3 turns the servo right

pin 4 turns the servo left

pin 8 controls the servo

The Circuit

20210531_211526[1].jpg

The ​processing Code + Arduino Code

The Code Function

code function documentation.png