Pages: [1]   Go Down
Author Topic: photo sensor  (Read 387 times)
0 Members and 1 Guest are viewing this topic.
Sulaymaniyah-Kurdistan-Iraq
Offline Offline
Jr. Member
**
Karma: 0
Posts: 90
stay foolish - stay hungry
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

when i plug 5v to the sensor it read too high i mean the degree but when i plug 3.3v it is normal
what is the problem??
Code:

int led = 13;
void setup () {
Serial.begin(9600);
 pinMode(led, OUTPUT);
 
}
void loop () {
int value = digitalRead(A1);
int value1 = analogRead(A1);
Serial.println(value1);
if (value == LOW) {
 digitalWrite(led, HIGH);
 
}
else
{
 digitalWrite(led, LOW);
 }
delay (1000)  ;
 
}
Logged

Montreal
Offline Offline
Faraday Member
**
Karma: 29
Posts: 2591
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your code doesn't make any sense to me, what you are trying to measure?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26332
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
what is the problem?
What is the sensor?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: