Skip to content

Commit c7d0d68

Browse files
committed
update sensor type
1 parent 8b7a866 commit c7d0d68

File tree

7 files changed

+45
-4
lines changed

7 files changed

+45
-4
lines changed

examples/YF-S201/Read_Flow_Rate/Read_Flow_Rate.ino

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
#include <Arduino.h>
1414
#include <FlowSensor.h>
1515

16+
// Sensor Type
17+
// YFS201;
18+
// YFB1;
19+
// OF10ZAT;
20+
// OF10ZZT;
21+
// OF05ZAT;
22+
// OF05ZZT;
23+
1624
// pin -> interrupt pin
1725
FlowSensor Sensor(YFS201, D2);
1826
unsigned long timebefore = 0; // Same type as millis()

examples/YF-S201/Read_Flow_Rate_and_Volume/Read_Flow_Rate_and_Volume.ino

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
#include <Arduino.h>
1414
#include <FlowSensor.h>
1515

16+
// Sensor Type
17+
// YFS201;
18+
// YFB1;
19+
// OF10ZAT;
20+
// OF10ZZT;
21+
// OF05ZAT;
22+
// OF05ZZT;
23+
1624
// pin -> interrupt pin
1725
FlowSensor Sensor(YFS201, D2);
1826
unsigned long timebefore = 0; // Same type as millis()

examples/YF-S201/Read_Volume/Read_Volume.ino

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
#include <Arduino.h>
1414
#include <FlowSensor.h>
1515

16+
// Sensor Type
17+
// YFS201;
18+
// YFB1;
19+
// OF10ZAT;
20+
// OF10ZZT;
21+
// OF05ZAT;
22+
// OF05ZZT;
23+
1624
// pin -> interrupt pin
1725
FlowSensor Sensor(YFS201, D2);
1826
unsigned long timebefore = 0; // same type as millis()

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "FlowSensor",
3-
"version": "1.0.2",
3+
"version": "1.1.0",
44
"keywords": "sensor, arduino",
55
"description": "Water Flow Rate, Water Volume",
66
"repository": {

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=FlowSensor
2-
version=1.0.2
2+
version=1.1.0
33
author=hafidhh
44
maintainer=hafidhh <hafidhhidayat@hotmail.com>
55
sentence=FlowSensor library for Arduino

src/FlowSensor.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ FlowSensor::FlowSensor(uint8_t type ,uint8_t pin)
2828
case YFS201:
2929
_pulse1liter = 450;
3030
break;
31+
32+
case YFB1:
33+
_pulse1liter = 660;
34+
break;
35+
36+
case OF10ZAT:
37+
_pulse1liter = 400;
38+
break;
39+
40+
case OF05ZAT:
41+
_pulse1liter = 2174;
42+
break;
3143

3244
default:
3345
break;

src/FlowSensor.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,19 @@
1616
#include "Arduino.h"
1717

1818
static const uint8_t YFS201{1};
19+
static const uint8_t YFB1{2};
20+
static const uint8_t OF10ZAT{3};
21+
static const uint8_t OF10ZZT{3};
22+
static const uint8_t OF05ZAT{4};
23+
static const uint8_t OF05ZZT{4};
1924

2025
class FlowSensor
2126
{
2227
private:
2328
uint8_t _pin;
2429
uint8_t _type;
25-
int _totalpulse;
26-
int _pulse;
30+
volatile int _totalpulse;
31+
volatile int _pulse;
2732
float _pulse1liter;
2833
float _flowrateminute;
2934
float _flowratesecound;

0 commit comments

Comments
 (0)