How to read values from an analog sensor ???
#1
Posted 03 October 2011 - 08:19 AM
I am using the following flow sensors for measuring the water flow through the pipe. But i don't know how to read the values from these sensors. I searched the google and found out that i have to use the PWM pins for taking the input from the sensor, which actually counts the number of pulses. But i don't know how to program it in c#. Can any one please help me with the code.
regards
Beowolf
#2
Posted 03 October 2011 - 08:39 AM
Sounds like you should be a ble to do this with an InterruptPort:I am using the following flow sensors for measuring the water flow through the pipe. But i don't know how to read the values from these sensors. I searched the google and found out that i have to use the PWM pins for taking the input from the sensor, which actually counts the number of pulses. But i don't know how to program it in c#. Can any one please help me with the code.
_counter = new InterruptPort(Pins.GPIO_PIN_19, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh); _counter.OnInterrupt += new NativeEventHandler(_counter_OnInterrupt);This sets up an InterruptPort on Pin 19 if a Mini.
void _counter_OnInterrupt(uint data1, uint data2, DateTime time) { }Drop your counter code in the OnInterrupt method.
I'm assuming that you have the electronics sorted out so that the sensor is not generating more than 5V input to the Netduino.
Hope this helps,
Mark
To be or not to be = 0xFF
Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life
Follow @nevynuk on Twitter
#3
Posted 03 October 2011 - 10:52 AM
-- H.L. Mencken, "What I Believe"
#4
Posted 07 October 2011 - 01:12 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users