/***
This example is intended to demonstrate the use of the GPIO Viewer Library.
Tutorial : https://youtu.be/UxkOosaNohU
Latest Features : https://youtu.be/JJzRXcQrl3I
Documentation : https://github.com/thelastoutpostworkshop/gpio_viewer
// Last tested on:
// Espressif Arduino Core v3.2.0
// ESP Async WebServer 3.7.7
// AsyncTCP 3.4.0
***/
// Since version 1.5.6, the library detects pin functions like ADC and Touch, this has been causing problems on some boards, like the XiaoESP32-S3-Sense. You can disable pin detection by uncommenting the following line:
// #define NO_PIN_FUNCTIONS
#include <gpio_viewer.h> // Must me the first include in your project
GPIOViewer gpio_viewer;
int led = 9; // the PWM pin the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
void setup()
{
Serial.begin(115200);
pinMode(led, OUTPUT);
// Comment the next line, If your code aleady include connection to Wifi in mode WIFI_STA (WIFI_AP and WIFI_AP_STA are not supported)
gpio_viewer.connectToWifi("Pritpal Singh", "1-Pritpal");
// gpio_viewer.setPort(5555); // You can set the http port, if not set default port is 8080
// Your own setup code start here
// Must be at the end of your setup
// gpio_viewer.setSamplingInterval(25); // You can set the sampling interval in ms, if not set default is 100ms
gpio_viewer.begin();
}
// You don't need to change your loop function
void loop() {
// set the brightness of pin 9:
analogWrite(led, brightness);
// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}