Ping Pong Raspberry Pi

Uncategorized — amyfried @ 3:11 pm

photo

1 2

Concept: The main concept was to create a ping pong game using openFrameworks, raspberry pi, and 3 inputs from sensors or buttons.

Process: I began with using one button to change the color of an ellipse from red to green when pushed. Next I added in a rectangle to move up and down when the button is pressed, I also changed the code of the ellipse to add speed to its x and y directions. When the ellipse hits the edges of the preset window it bounces off at an angle. When I got that to run I added a second button and another rectangle to be moved up and down by the push of the button. Finally I attached a potentiometer to increase the ellipses speed when the potentiometer is moved (digitalWrite set on HIGH).

Lessons Learned: This was my first time working with a raspberry pi, and openFrameworks. I have been familiar with Arduino, and Processing 2.0, but it was a new experience to work in openFrameworks which allows to work in unison the elements of the other programs. In order for me to understand openFrameworks I went step by step to add elements to the program to expand upon. In processing I would be able to make a rectangle in Center Mode, but errors kept occurring so I couldnt utilize this in openFrameworks. Next I tried to create collisions by determining the distance between the center of the ellipse and the length of the pong paddles. In Processing 2.0 I would just use dist() to determine this number, but in openFrameworks I had trouble using this command to work for me. I also found out that to create collisions one should use the gravity tool, but I couldnt figure out how to use this function also.

0 Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2020 Making Things Interactive | powered by WordPress with Barecity