upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API for the Grove Water Flow Sensor. More...

Detailed Description

However, be careful when wiring this up - the schematic appears to have a bug in it: the lower left connection of the signal line (yellow) to Vcc (red) should not be there. The sensor can work with this connection, but probably not for very long.

grovewfs.jpg
// Instantiate a Grove Water Flow Sensor on digital pin D2
flow.startFlowCounter();
while (true) {
System.out.print("Millis: " + flow.getMillis() + " FlowCount: " + flow.flowCounter());
System.out.println(" Flow Rate: " + flow.flowRate() + " LPM");
Thread.sleep(2000);
}

Public Member Functions

synchronized void delete ()
 
 GroveWFS (int pin)
 
long getMillis ()
 
void initClock ()
 
void clearFlowCounter ()
 
void startFlowCounter ()
 
void stopFlowCounter ()
 
long flowCounter ()
 
float flowRate ()
 

Constructor & Destructor Documentation

GroveWFS ( int  pin)

Grove Water Flow sensor constructor

Parameters
pinDigital pin to use

Member Function Documentation

void clearFlowCounter ( )

Resets the flow counter to 0. The flow counter should be stopped via stopFlowCounter() prior to calling this function.

long flowCounter ( )

Gets the flow counter

Returns
Flow counter
float flowRate ( )

Computes the flow rate in liters per minute (LPM)

Returns
Computed flow rate
long getMillis ( )

Returns the number of milliseconds elapsed since initClock() was last called.

Returns
Elapsed milliseconds
void initClock ( )

Resets the clock

void startFlowCounter ( )

Starts the flow counter

void stopFlowCounter ( )

Stops the flow counter


The documentation for this class was generated from the following file: