Pages: [1]   Go Down
Author Topic: Playing a game with a photo resistor connected to Arduino  (Read 1597 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, guys! Here's a simple project, where I use photo resistor to control player's location on the screen. (game coded with Processing)
« Last Edit: April 16, 2013, 01:44:42 pm by Metalex » Logged

Offline Offline
Sr. Member
****
Karma: 9
Posts: 252
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

smiley 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.



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

My 3x3x3 Led Cube

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

Offline Offline
Sr. Member
****
Karma: 9
Posts: 252
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley and trying some changes in the code.



* game.jpg (23.15 KB, 741x541 - viewed 37 times.)
Logged

My 3x3x3 Led Cube

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

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Offline Offline
Sr. Member
****
Karma: 9
Posts: 252
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

smiley-wink

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

But I'm going to start from 0 so I can learn proccesing better.
Logged

My 3x3x3 Led Cube

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

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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





 smiley-wink
Logged

Offline Offline
Sr. Member
****
Karma: 9
Posts: 252
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot smiley

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 smiley

***
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 smiley
Logged

My 3x3x3 Led Cube

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

Offline Offline
Sr. Member
****
Karma: 9
Posts: 252
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



This is the small modification I made till now smiley-razz

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 smiley-razz

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





Logged

My 3x3x3 Led Cube

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

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool update! It's fun to see my project grow smiley-grin
Logged

Pages: [1]   Go Up
Jump to: