void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
}
int T=10; // ms
int n=0;
float f=0;
float y_=0;
float A=0;
void loop() {
// put your main code here, to run repeatedly:
float v=1000*sin(2*PI*1*n*T/1000);
float y=v+f;
float x=(y-y_)*1.5;
f=f*0.99+x*0.01*2;
y_=y_*0.99+x*0.01*A;
float e=y-y_;
A+=0.00000000001*e*x;
Serial.print(v); Serial.print(' ');
Serial.print(f); Serial.print(' ');
Serial.print(y); Serial.print(' ');
Serial.print(x); Serial.print(' ');
Serial.print(A*1000); Serial.print(' ');
Serial.println();
n++;
delay(T); // this speeds up the simulation
}
Loading
esp32-devkit-c-v4
esp32-devkit-c-v4