Raspberry Pi - Photocell sample

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ecpert
 
Posts: 2
Joined: Fri Sep 05, 2014 1:09 pm

Raspberry Pi - Photocell sample

Post by ecpert »

Dear all,

I've been playing around with my Raspberry Pi and the photocell sample. I have tried with three different photocells, and three 1uF capacitors, just in case, and I always get 1 as the output by the python script ... so it doesń't seem to be working like it is expected.

Tried other scripts to turn leds on/off without any problems. I also had a I2C Temp Sensor and the GPS working fine ...

I wonder if it is related with the Python + RPi.GPIO library versions that i'm using ? Python is 2.7.3 and RPi.GPIO is 0.5.6 .

Any ideas on how to get this running would be much appreciated. Thanks in advance!

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Raspberry Pi - Photocell sample

Post by adafruit_support_mike »

Post a photo of your hardware and connections. We'll see if those give us any clues.

User avatar
ecpert
 
Posts: 2
Joined: Fri Sep 05, 2014 1:09 pm

Re: Raspberry Pi - Photocell sample

Post by ecpert »

Hi again, i'm afraid an extra tabulator in the code is the responsible. The "return reading" instruction should be at the same level of indentation as the while clause ... and I had it at the same level as the instruction incrementing the counter, hence the while was only executed once.

I'm a bit embarrassed, to be honest, but had to share the info just in case anyone else had the same problem !

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Raspberry Pi - Photocell sample

Post by adafruit_support_mike »

Hey, this is an embarrassment-free zone. ;-)

We all do things like that once in a while, and most mistakes are only obvious *after* you know what happened. Knowledge is the flag at the top of a mountain of mistakes most people don't want to admit until they find themselves in the right crowd.

The right crowd is made up of people who've seen and understood these two videos:

https://www.youtube.com/watch?v=xhQ7d3BK3KQ - Jeri Ellsworth: Fail and Fail Often
https://www.youtube.com/watch?v=rDjrOaoHz9s - Extra Credits: Fail Faster

We get that, and we have our own piles of "oh geez" moments holding us up. Around here, "dumb mistake on my part" doesn't mean you made it.. it means you found it and you fixed it. ;-)

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”