Set onewire bus
This commit is contained in:
parent
1e79588e98
commit
3a2ddb92e3
@ -2,6 +2,9 @@
|
|||||||
#include "driver/pcnt.h"
|
#include "driver/pcnt.h"
|
||||||
#include <VL53L0X.h>
|
#include <VL53L0X.h>
|
||||||
|
|
||||||
|
#define SENSOR_TANK_SDA GPIO_NUM_16 /**< GPIO 16 - echo feedback of water sensor */
|
||||||
|
#define SENSOR_TANK_SCL GPIO_NUM_17 /**< GPIO 17 - trigger for water sensor */
|
||||||
|
|
||||||
|
|
||||||
#define OUTPUT_SENSOR 14
|
#define OUTPUT_SENSOR 14
|
||||||
#define SENSOR_PLANT 17
|
#define SENSOR_PLANT 17
|
||||||
@ -18,6 +21,10 @@ void setup()
|
|||||||
Serial.println("Nodemcu ESP32 Start done");
|
Serial.println("Nodemcu ESP32 Start done");
|
||||||
|
|
||||||
tankSensor.setTimeout(500);
|
tankSensor.setTimeout(500);
|
||||||
|
Wire.begin(SENSOR_TANK_SDA, SENSOR_TANK_SCL, 100000UL /* 100kHz */);
|
||||||
|
tankSensor.setTimeout(500);
|
||||||
|
tankSensor.setBus(&Wire);
|
||||||
|
delay(20);
|
||||||
long start = millis();
|
long start = millis();
|
||||||
bool distanceReady = false;
|
bool distanceReady = false;
|
||||||
while (start + 500 > millis())
|
while (start + 500 > millis())
|
||||||
|
Loading…
Reference in New Issue
Block a user