Pages: [1]   Go Down
Author Topic: Hall Sensor on analog pin  (Read 433 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello

I am using the http://www.seeedstudio.com/depot/datasheet/water%20flow%20sensor%20datasheet.pdf  this sensor with ATtiny85.
The datasheet specifies the output as a digital pulse.

I use it as an interrupt and the sensor works perfectly when connected and tested with the digital pin on Arduino.
Because I am already using both the digital pins of ATtiny, I am connecting the sensor to the analogue pin of ATtiny but I am not getting the expected result.

I tried to use the digital pin to debug my code. But I want to make if the sensor is intended to work with digital pin only? or it can also work with the Analogue pin ?

Thanks
Logged

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

Quote
I use it as an interrupt and the sensor works perfectly when connected and tested with the digital pin on Arduino.
You can't use the analogue pin to generate an interrupt.
Can you redeploy one of your other digital signals to the analogue pins and use a real digital pin?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 202
Posts: 8708
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Any signal that works with a digital input pin (0V, 5V) will work with an analog input. The analogRead() function will return a value near 0 for logic LOW signals and a value near 1023 for logic HIGH signals.  Compare the returned value with 512 (mid range) to get a logic value.

Most (but not all) analog input pins can also be used for digital inputs and outputs. I don't know if the core you are using supports this or not.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: