Daniel and Jason’s Spinning Shapes

Content

The Spinning Shapes toy is tilted at a 45 degree angle so when the shapes are placed they can fall into the holder created. A large tire turns the blue holder. There are 3 speeds, slow, medium, and fast. When pressed, a timer will start with a beeping noise repeating more often as the game progresses until the user runs out of time with a long beep. The wheel has a 50 percent chance of changing direction and when it does, it changes the direction of the blue holder. 

In the code for this robot, we had a while loop around 3 "read sensor" functions, and this loop would end once this action was true for any of these buttons. We then had nested case structures, to change the power of the motor for each button pressed. This motor was inside of a for loop, along with a tone being played. Each iteration of the while loop got shorter by 1 second, starting at seven seconds. At the beginning of each iteration of the for loop, a random number would be generated, which determines whether the rotation of the motor will be either positive or negative. Finally, after the for loop had finished, one longer tone would play to signify the end of time for the game, and the motors would stop. All of this was inside of an infinite while loop, making this repeat forever.
 

Gallery
Video
Improvements from Prototype

 From the last build we changed alot. We added a larger tire for more traction when it touches the blue holder. Additionally, there are now 3 speeds which the user can choose from. A stopper was also made to make sure peices would not fall out as regularly as last time. Also, a timer was created that lets the user know how much time they have left by making buzzes. To make the game more difficult, we also added the chance of the wheel changing direction throwing off the user. A huge change we made was the overall design. By mimicing what was built on either side, we made it more stable. 

In the code, improvements were made to match the physical improvements of the machine. The code became more complex to match what we wanted the machine to do. We needed nested loops to perform the functions such as random changes in direction and multiple sensors controlling the same motor.

Attachments
AttachmentTypeSize
speedbasedonsensor_584f21ecb7affSpeed Based on Sensor.vi29.47 KB

Leave a Reply

Your email address will not be published. Required fields are marked *