Skip to content

Commit 7147d47

Browse files
committed
change name
1 parent c034e67 commit 7147d47

File tree

5 files changed

+29
-24
lines changed

5 files changed

+29
-24
lines changed

examples/YF-S201/Read_Flow_Rate/Read_Flow_Rate.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
*
1010
* Github :
1111
* https://github.com/hafidhh
12+
* https://github.com/hafidhh/FlowSensor-Arduino
1213
*/
1314

1415
#include <Arduino.h>
15-
#include <FlowSensor_Arduino.h>
16+
#include <FlowSensor.h>
1617

1718
// pin -> interrupt pin
18-
FlowSensor_Arduino Sensor(YFS201, D2);
19+
FlowSensor Sensor(YFS201, D2);
1920
int timebefore = 0;
2021

2122
void count()

examples/YF-S201/Read_Flow_Rate_and_Volume/Read_Flow_Rate_and_Volume.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
*
1010
* Github :
1111
* https://github.com/hafidhh
12+
* https://github.com/hafidhh/FlowSensor-Arduino
1213
*/
1314

1415
#include <Arduino.h>
15-
#include <FlowSensor_Arduino.h>
16+
#include <FlowSensor.h>
1617

1718
// pin -> interrupt pin
18-
FlowSensor_Arduino Sensor(YFS201, D2);
19+
FlowSensor Sensor(YFS201, D2);
1920
int timebefore = 0;
2021

2122
void count()

examples/YF-S201/Read_Volume/Read_Volume.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
*
1010
* Github :
1111
* https://github.com/hafidhh
12+
* https://github.com/hafidhh/FlowSensor-Arduino
1213
*/
1314

1415
#include <Arduino.h>
15-
#include <FlowSensor_Arduino.h>
16+
#include <FlowSensor.h>
1617

1718
// pin -> interrupt pin
18-
FlowSensor_Arduino Sensor(YFS201, D2);
19+
FlowSensor Sensor(YFS201, D2);
1920
int timebefore = 0;
2021

2122
void count()

src/FlowSensor_Arduino.cpp renamed to src/FlowSensor.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file FlowSensor_Arduino.cpp
2+
* @file FlowSensor.cpp
33
* @author Hafidh Hidayat ([email protected])
44
* @brief
55
* @version 1.0.0
@@ -9,18 +9,19 @@
99
*
1010
* Github :
1111
* https://github.com/hafidhh
12+
* https://github.com/hafidhh/FlowSensor-Arduino
1213
*/
1314

1415
#include "Arduino.h"
15-
#include "FlowSensor_Arduino.h"
16+
#include "FlowSensor.h"
1617

1718
/**
18-
* @brief Construct a new FlowSensor_Arduino::FlowSensor_Arduino object
19+
* @brief Construct a new FlowSensor::FlowSensor object
1920
*
2021
* @param type
2122
* @param pin
2223
*/
23-
FlowSensor_Arduino::FlowSensor_Arduino(uint8_t type ,uint8_t pin)
24+
FlowSensor::FlowSensor(uint8_t type ,uint8_t pin)
2425
{
2526
_pin = pin;
2627
_type = type;
@@ -40,7 +41,7 @@ FlowSensor_Arduino::FlowSensor_Arduino(uint8_t type ,uint8_t pin)
4041
*
4142
* @return uint8_t pin
4243
*/
43-
uint8_t FlowSensor_Arduino::getPin()
44+
uint8_t FlowSensor::getPin()
4445
{
4546
return this->_pin;
4647
}
@@ -50,7 +51,7 @@ uint8_t FlowSensor_Arduino::getPin()
5051
*
5152
* @return uint8_t sensor type
5253
*/
53-
uint8_t FlowSensor_Arduino::getType()
54+
uint8_t FlowSensor::getType()
5455
{
5556
return this->_type;
5657
}
@@ -59,7 +60,7 @@ uint8_t FlowSensor_Arduino::getType()
5960
* @brief count pulse
6061
*
6162
*/
62-
void FlowSensor_Arduino::count()
63+
void FlowSensor::count()
6364
{
6465
this->_pulse++;
6566
this->_totalpulse++;
@@ -70,7 +71,7 @@ void FlowSensor_Arduino::count()
7071
*
7172
* @param userFunc
7273
*/
73-
void FlowSensor_Arduino::begin(void (*userFunc)(void))
74+
void FlowSensor::begin(void (*userFunc)(void))
7475
{
7576
pinMode(this->_pin, INPUT);
7677
digitalWrite(this->_pin, HIGH); // Optional Internal Pull-Up
@@ -82,7 +83,7 @@ void FlowSensor_Arduino::begin(void (*userFunc)(void))
8283
*
8384
* @param calibration
8485
*/
85-
void FlowSensor_Arduino::read(int calibration)
86+
void FlowSensor::read(int calibration)
8687
{
8788
this->_flowratesecound = (this->_pulse / (this->_pulse1liter + calibration)) / ((millis() - _timebefore) / 1000);
8889
this->_volume += (this->_pulse / (this->_pulse1liter + calibration));
@@ -94,7 +95,7 @@ void FlowSensor_Arduino::read(int calibration)
9495
*
9596
* @return int total pulse
9697
*/
97-
int FlowSensor_Arduino::getPulse()
98+
int FlowSensor::getPulse()
9899
{
99100
return this->_totalpulse;
100101
}
@@ -104,7 +105,7 @@ int FlowSensor_Arduino::getPulse()
104105
*
105106
* @return float flow rate / minute
106107
*/
107-
float FlowSensor_Arduino::getFlowRate_m()
108+
float FlowSensor::getFlowRate_m()
108109
{
109110
this->_flowrateminute = this->_flowratesecound * 60;
110111
return this->_flowrateminute;
@@ -115,7 +116,7 @@ float FlowSensor_Arduino::getFlowRate_m()
115116
*
116117
* @return float flow rate / secound
117118
*/
118-
float FlowSensor_Arduino::getFlowRate_s()
119+
float FlowSensor::getFlowRate_s()
119120
{
120121
return this->_flowratesecound;
121122
}
@@ -125,7 +126,7 @@ float FlowSensor_Arduino::getFlowRate_s()
125126
*
126127
* @return float volume
127128
*/
128-
float FlowSensor_Arduino::getVolume()
129+
float FlowSensor::getVolume()
129130
{
130131
return this->_volume;
131132
}

src/FlowSensor_Arduino.h renamed to src/FlowSensor.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file FlowSensor_Arduino.h
2+
* @file FlowSensor.h
33
* @author Hafidh Hidayat ([email protected])
44
* @brief
55
* @version 1.0.0
@@ -9,16 +9,17 @@
99
*
1010
* Github :
1111
* https://github.com/hafidhh
12+
* https://github.com/hafidhh/FlowSensor-Arduino
1213
*/
1314

14-
#ifndef FlowSensor_Arduino_h
15-
#define FlowSensor_Arduino_h
15+
#ifndef FlowSensor_h
16+
#define FlowSensor_h
1617

1718
#include "Arduino.h"
1819

1920
static const uint8_t YFS201{1};
2021

21-
class FlowSensor_Arduino
22+
class FlowSensor
2223
{
2324
private:
2425
uint8_t _pin;
@@ -32,7 +33,7 @@ class FlowSensor_Arduino
3233
long _timebefore = 0;
3334

3435
public:
35-
FlowSensor_Arduino(uint8_t type ,uint8_t pin);
36+
FlowSensor(uint8_t type ,uint8_t pin);
3637
uint8_t getPin();
3738
uint8_t getType();
3839
void begin(void (*userFunc)(void));

0 commit comments

Comments
 (0)