//test esp32
// Second = 1000; // Interval voor de seconde update (1000 milliseconden = 1 seconde)
// Minute = 60000; // Interval voor de minuut update (60000 milliseconden = 1 minuut)
// 5 minutes = 300000;
// 10 minutes = 600000;
// QuarterHour = 900000; // Interval voor de kwartier update (900000 milliseconden = 15 minuten)
// HalfHour = 1800000;
// Hour = 3600000;
// I2C 16x2 LCD
#include <Wire.h>
#include <LiquidCrystal_I2C.h> // Library for LCD
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27, 16 column and 2 rows
const unsigned long sensorTimer = 120000; // 2 minutes
const unsigned long transmitTimer = 120000; // 2 minutes
unsigned long previousTime_sensorTimer = 0;
unsigned long previousTime_transmitTimer = 0;
const int buttonPin = 3; // the number of the pushbutton pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
Serial.begin(115200);
pinMode(13, OUTPUT);
pinMode(buttonPin, INPUT);
Serial.println("Hello Arduino Nano ESP32!");
lcd.init();
}
void loop() {
unsigned long currentTime = millis();
// HC12 timer stuff
if( currentTime - previousTime_sensorTimer >= sensorTimer){
Serial.println("SensorTest!");
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
previousTime_sensorTimer = currentTime;
}
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
lcd.backlight();
lcd.display();
} else {
// turn LED off:
lcd.noDisplay();
lcd.noBacklight();
}
/**
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
lcd.setCursor(0,0);
lcd.print("Hello, From");
lcd.setCursor(0,1);
lcd.print("Arduino_uno_guy");
// Bouw JSON-bericht
String payload = "{\"temp\":" + String(temperature, 1) +
",\"hum\":" + String(humidity, 1) +
",\"dist\":" + String(distance, 1) + "}";
**/
}
Loading
arduino-nano-esp32
arduino-nano-esp32