Pages: [1]   Go Down
Author Topic: Infrared - Sharp 2D120X problem please help me  (Read 1648 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, I am so frustrated on trying to make this thing work. I'm Newbie! Please correct me.
there are 3 color of wire, red wire to 5v, yellow to A1 (analog), black to ground.
I got this as the result:

100
6
45
108
123
37
0
0
15
79
128
104
8
0




Code:
//Reads and analog sensor and displays the value
int sensePin = 7;

void setup()
{
  //Note: We don't need to specifiy sensePin as an
  //input, since it defaults to that when we read it

  //This is the default value, but we can set it anyways
  analogReference(DEFAULT); //5V Reference on UNO
 
  //Allows us to listen to serial communications from the arduino
  Serial.begin(9600);
}

void loop()
{
  // print the button state to a serial terminal
  Serial.println(analogRead(A1));
  delay(500);
  //wait half a second, then print again.
}

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33362
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like you haven't wired it up correctly. Is the ground connected? Is the power connected to the sensor?

For best help provide a link to the sensor's data sheet.
Logged

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

There is 3 wire, black on the left, red in the middle, yellow on the right. black connect to Ground, red to 5v., yellow to A0.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33362
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The data sheet says to connect a 47uF capacitor across the supply as close to the sensor as you can get. Try that.
Logged

Pages: [1]   Go Up
Jump to: