Go Down

Topic: 2 questions about analog (Read 783 times) previous topic - next topic

tomer1510

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: [Select]

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?

AWOL

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.
"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.

MarkT

Use Serial.println(), not Serial.write()
[ I won't respond to messages, use the forum please ]

tomer1510

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

tomer1510

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

AWOL

Quote
but what code would make the buzzer buzz

digitalWrite?
Where's the link to the buzzer?
"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.

Go Up