Go Down

Topic: Playing a game with a photo resistor connected to Arduino (Read 1 time) previous topic - next topic

Metalex

Apr 16, 2013, 06:22 pm Last Edit: Apr 16, 2013, 08:44 pm by Metalex Reason: 1
Hi, guys! Here's a simple project, where I use photo resistor to control player's location on the screen. (game coded with Processing)
http://www.youtube.com/watch?v=rOUBr6Nmzec

American2020

:) I love this project...

Really good one.

Thanks for sharing.

PD: Just one tip, you can add this. (I see you have to modify the code, according to your light values) Take a look at this, for sure it will be a good addition for your code.

http://www.youtube.com/watch?v=57S3dylfw3I

You will see him explaining how to add an "Auto-setup" of the high and low values the photo resistor can read.
My 3x3x3 Led Cube

[url=http://arduino.cc/forum/index.php/topic,1642

American2020

I was playing the game, I used a potentiometer to control it.

Just 2 questions. I had to use A0 as an input and not Pin 12.

And another question. Why I lost in the attached file?

Is it possible that a red dot was hiding under the green one, or the code is made to avoid that?

Thanks a lot, I will continue playing :) and trying some changes in the code.

My 3x3x3 Led Cube

[url=http://arduino.cc/forum/index.php/topic,1642

Metalex

Thanks for your response! It is possible that a red dot was hiding under the green one (it can be fixed by drawing red dots after green ones), because all of them are generated randomly. And I don't think that the input pin matters, as long as it's analog.
I'm glad, that you're having fun checking out this project! Good luck!

American2020

Yes, then I realice it was a A12 and not a 12. I have a Nano and 12 was took as Digital Pin 12, and not like in a Mega, Analog 12

;)

Having fun, and not only that, I'm trying to make my version including some .svg graphics to the design :P

But I'm going to start from 0 so I can learn proccesing better.
My 3x3x3 Led Cube

[url=http://arduino.cc/forum/index.php/topic,1642

Metalex

Cool! You may check out these tutorials on Serial Communication between Arduino and Processing:

http://www.youtube.com/watch?v=g0pSfyXOXj8
http://www.youtube.com/watch?v=rS8SiqIyy5c
http://www.youtube.com/watch?v=t5W1jbOaUWs&list=UU20Qd3fL_ddwvtys-wilb4w&index=2

;)

American2020

Thanks a lot :)

The seconds 2 are new for me, the first one, I already saw it, that guy is a genius, he has a series of over 10 Tutorial about using Arduino, I had learn a lot thanks to those videos :)

***
Up to now, I'm "smoothing" the AnalogRead to send more stables reading through the Serial. And working in a new code in Proccesing to make a similar game with a few changes :)
My 3x3x3 Led Cube

[url=http://arduino.cc/forum/index.php/topic,1642

American2020



This is the small modification I made till now :P

The red dots moves faster, the greens stay at same speed.

The white box is now a "CandyMan"

The next steps would be change the green dots for candies, and the red ones for fruits, as this guy has horrible teeth he prefers the candies :P

I'm playing it with my recently built Joystick (Paddle, kinda like the Atari ones)





My 3x3x3 Led Cube

[url=http://arduino.cc/forum/index.php/topic,1642


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy