#include <Smooth.h>
#define SPEED_POT_PIN 12 // Speed potentiometer pin
#define BRIGHTNESS_POT_PIN 13 // Brightness potentiometer pin
#define SMOOTHED_SAMPLE_SIZE 10
Smooth smoothedSpeedPot(SMOOTHED_SAMPLE_SIZE);
Smooth smoothedBrightnessPot(SMOOTHED_SAMPLE_SIZE);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(12, INPUT);
pinMode(13, INPUT);
}
void readPotentiometers()
{
int speedPot = analogRead(12);
int brightnessPot = analogRead(13);
// Serial.print(speedPot);
// Serial.print(",");
// Serial.println(brightnessPot);
int smoothedSpeed = smoothedSpeedPot += speedPot;
int smoothedBrightness = smoothedBrightnessPot += brightnessPot;
Serial.println(smoothedSpeed);
Serial.print(",");
Serial.println(smoothedBrightness);
}
void loop() {
readPotentiometers();
delay(10); // this speeds up the simulation
}