Pages: [1]   Go Down
Author Topic: 2 questions about analog  (Read 757 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 1
Posts: 130
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First problem:
Im trying to read how much light my light sensor senses and it is connected to A0 through sensor shield
I used the following code:
Code:
int AmountOfLight = 0;
void setup()
{
  Serial.begin(9600);
}
void loop()
{

  AmountOfLight = analogRead(A5);
  Serial.write(AmountOfLight);
 
}
but it prints out random letters and numbers
what did I do wrong?





Question 2:
I have a buzzer moudle and a sensor shield and I want to make it buzz
where do I connect it and what code should I use?
Logged

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

How is your light sensor wired?
What is your light sensor?
Quote
I have a buzzer moudle and a sensor shield and I want to make it buzz
where do I connect it and what code should I use?
Well, we can't see them, so you'll need to help us there.
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.

0
Offline Offline
Shannon Member
****
Karma: 218
Posts: 12598
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Use Serial.println(), not Serial.write()
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Full Member
***
Karma: 1
Posts: 130
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

light sensor v4.0 flamingo EDA
has a0-a5 inputs and a com/iic input
the light sensor is http://www.flamingoeda.com/index.php?title=%E7%94%B5%E5%AD%90%E7%A7%AF%E6%9C%A8:%E5%85%89%E7%BA%BF%E4%BC%A0%E6%84%9F%E5%99%A8
and the buzzer has the same connector as the sensors and its made by falmingo EDA buzzer v1.0
I connected the light sensor through the sensor shield and I tried doing it in every combination

and serial.print/println() did make it print numbers and not random letters but not the right ones
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 130
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

nevermind I got the light sensor working
but what code would make the buzzer buzz?
Logged

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

Quote
but what code would make the buzzer buzz
digitalWrite?
Where's the link to the buzzer?
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: