Hi Ytai,
This is my current code (trimmed for this post)
int FLOW_METER_PIN = 14;
volatile float pulseFreq, totalPulse;
PulseInput flowMeter = ioio_.openPulseInput(FLOW_METER_PIN,
PulseInput.PulseMode.FREQ);
totalPulse = 0;
public void loop() throws ConnectionLostException, InterruptedException
{
pulseFreq = flowMeter.getFrequencySync();
totalPulse += pulseFreq;
//display totalPulse value to a textView;
Thread.sleep(100);
}
Current behavior is already as I expected, the totalPulse textView will
updated only when the hall sensor is spinning (flow detected)
If I use the getFrequencySync() method, I think the loop is paused, waiting
the flowMeter to receive input.
If it received input, the totalPulse will increase by the amount of
pulseFreq from getFrequencySync().
I haven't tested with real water yet (I just blow the flow sensor to make
the hall spin for early development test)
My question, is it correct to use this approach with the getFrequencySync()
method?
Or I still need to hack the DigitalInputImpl to count the pulses?
Thanks
On Wednesday, August 23, 2017 at 4:18:28 AM UTC+7, Ytai wrote:
>
> It is known, but there isn't currently a plan to add it. If anyone wants
> to contribute a patch, I will happily consider adopting it.
>
> On Aug 13, 2017 8:21 PM, "Maximillian" <[email protected] <javascript:>>
> wrote:
>
>> Is this still a known missing feature? As this post is from 2013.. I need
>> to use flow sensor as well..
>>
>> On Monday, September 9, 2013 at 10:31:46 AM UTC+7, Ytai wrote:
>>>
>>> This is known missing feature. You can work around this by hacking
>>> DigitalInputImpl to count the pulses: its setValue() method will get called
>>> on every edge.
>>>
>>>
>>> On Fri, Sep 6, 2013 at 11:21 AM, jorge sb <[email protected]> wrote:
>>>
>>>> Hi. I want to connect a hall sensor flow meter to ioio.
>>>> Perhaps, I could use "PulseInput" but after reading ioio-wiki, I see
>>>> that I can't do it with it.
>>>> Really, I need a simple pulse counter but without loosing any pulse.
>>>> With flow meter I will like to get:
>>>> - Total liquid flow (accumulated countered pulses)
>>>> - Instant flow (reading difference between two counts in a measured
>>>> time).
>>>>
>>>> With this sensor I could get a pulse every 50 msec or less at max rate.
>>>> I think I could loose pulses doing periodic read of digital input.
>>>>
>>>> Some suggestion.
>>>> Thanks.
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "ioio-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at http://groups.google.com/group/ioio-users.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "ioio-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/ioio-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.