Pages: [1]   Go Down
Author Topic: LDR - Figure 5-5 Example 2 - Need Help  (Read 8317 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys (im a super newb so bare with me),

I'm on page 61 on Getting Started with Arduino 2nd Edition, and I'm having a bit of trouble with the LDR resistor.

I grabbed the code from Example 02 and I followed the directions in putting it together using the 10k resistor (Brown Violet Orange and Gold)

After hooking everything up I put my hand over it and nothing happens the light stays on, I know you guys are experts and I'm sorry to bother you guys with this newbie question what am I doing wrong?

Thanks guys for reading and helping out,

Best Regards,

David O

Code just in case

// Example 02: Turn on LED while the button is pressed

const int LED = 13;   // the pin for the LED
const int BUTTON = 7; // the input pin where the
                      // pushbutton is connected
int val = 0;          // val will be used to store the state
                      // of the input pin

void setup() {
  pinMode(LED, OUTPUT); // tell Arduino LED is an output
  pinMode(BUTTON, INPUT); // and BUTTON is an input
 }

void loop(){
  val = digitalRead(BUTTON); // read input value and store it

  // check whether the input is HIGH (button pressed)
  if (val == HIGH) {
    digitalWrite(LED, HIGH); // turn LED ON
  } else {
    digitalWrite(LED, LOW);
   }
  }


* Figure_5_5.JPG (2227.25 KB, 3264x2448 - viewed 68 times.)
« Last Edit: October 09, 2013, 07:31:32 pm by dvd7227 » Logged

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

Hi Guys,

I figured it out,

sorry for bothering everyone.
Logged

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

Hello,

I am having the same problem. How were you able to resolve?
Logged

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

Hello,

I am having the same problem. How were you able to resolve?

Hi Craft,

Here's how I got it,

I was surfing the web after posting this and someone on youtube was in depth about this certain project.

The light sensitivity is the issue.

http://rookieelectronics.com/light-sensor-using-arduino/

Copy and paste the code, then follow the video and when he mentions light sensitivity play close attention to that part with the monitor and set it by the lighting in your room, so if it's at 460 put it below that.

Happy Hacking,

David
Logged

Pages: [1]   Go Up
Jump to: