#include <Arduino.h>
#include <ESP32Servo.h>
#include <avdweb_VirtualDelay.h>


// RGB LED Gaussian Wave Breathing LED


float smoothness_pts = 500;//larger=slower change in brightness  

float gammaTrans1 = 0.14; // affects the width of peak (more or less darkness)
float gammaTrans2 = 0.05; // affects the width of peak (more or less darkness)
float beta = 0.5; // shifts the gaussian to be symmetric



// #include <Arduino.h>
Servo myservo1;  // create servo object to control a servo
Servo myservo2; 



const int Servo1pin = 23 ;  // analog pin used to connect the potentiometer
const int Servo2pin = 22 ;  //

int potPin1 = 26;  // analog pin used to connect the potentiometer
int val1;    // variable to read the value from the analog pin
int potPin2 = 27;  // analog pin used to connect the potentiometer
int val2;    // variable to read the value from the analog pin


void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("up in X Z-Rot and X-Rot values");

  myservo1.attach(Servo1pin);  // attaches the servo on pin 9 to the servo object
  myservo2.attach(Servo2pin); 

}



void loop() {
  // put your main code here, to run repeatedly:
 
 

/*
  for (int ii=0;ii<smoothness_pts;ii++){
    float pwm_val1 = 180.0*(exp(-(pow(((ii/smoothness_pts)-beta)/gammaTrans1,2.0))/2.0));
      myservo1.write(pwm_val1);  
          float pwm_val2 = 180.0*(exp(-(pow(((ii/smoothness_pts)-beta)/gammaTrans2,2.0))/2.0));
      myservo2.write(pwm_val2); 

    delay(5);
    Serial.println(int(pwm_val1));
        Serial.println(int(pwm_val2));
  }
*/


  }