Skip to content

Commit a578fed

Browse files
committed
Fix error ESP8266 and ESP32
1 parent 2c65841 commit a578fed

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

examples/YF-S201/Read_Flow_Rate/Read_Flow_Rate.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
FlowSensor Sensor(YFS201, D2);
2020
int timebefore = 0;
2121

22+
// Uncomment if use ESP8266 and ESP32
23+
// void IRAM_ATTR count()
24+
// {
25+
// Sensor.count();
26+
// }
27+
28+
// Comment if use ESP8266 and ESP32
2229
void count()
2330
{
2431
Sensor.count();

examples/YF-S201/Read_Flow_Rate_and_Volume/Read_Flow_Rate_and_Volume.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
FlowSensor Sensor(YFS201, D2);
2020
int timebefore = 0;
2121

22+
// Uncomment if use ESP8266 and ESP32
23+
// void IRAM_ATTR count()
24+
// {
25+
// Sensor.count();
26+
// }
27+
28+
// Comment if use ESP8266 and ESP32
2229
void count()
2330
{
2431
Sensor.count();

examples/YF-S201/Read_Volume/Read_Volume.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
FlowSensor Sensor(YFS201, D2);
2020
int timebefore = 0;
2121

22+
// Uncomment if use ESP8266 and ESP32
23+
// void IRAM_ATTR count()
24+
// {
25+
// Sensor.count();
26+
// }
27+
28+
// Comment if use ESP8266 and ESP32
2229
void count()
2330
{
2431
Sensor.count();

src/FlowSensor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void FlowSensor::count()
7474
void FlowSensor::begin(void (*userFunc)(void))
7575
{
7676
pinMode(this->_pin, INPUT);
77-
digitalWrite(this->_pin, HIGH); // Optional Internal Pull-Up
77+
digitalWrite(this->_pin, INPUT_PULLUP); // Optional Internal Pull-Up
7878
attachInterrupt(this->_pin, userFunc, RISING);
7979
}
8080

0 commit comments

Comments
 (0)