float b[] = {-1.6379691026637445E-5,-2.8460879135414476E-5,-3.4794861698667389E-5,
-2.5672711408749189E-5,7.3839908593977014E-6,6.6768050564703366E-5,
0.00014422074464800732,0.00021865076770471255,0.00025828014307718248,
0.00022807263841626016,0.00010169330090088124,-0.00012475869000674278,
-0.00042165090257533178,-0.00072233646839760571,-0.00093124998354411647,
-0.00094480407039777337,-0.00068232348448825353,-0.00012002668894077263,
0.00068204868917140081,0.0015709551142810392,0.0023177424144010684,
0.0026626279591927945,0.0023825683282535722,0.0013670130348424061,
-0.00031845768496770058,-0.0024023519489018031,-0.0044284390677612447,
-0.00583430818467503,-0.0060789084509289314,-0.0047950725846565411,
-0.00193093675781346,0.0021603815586255671,0.0067178785267979933,
0.0106755431378323,0.012866146367293229,0.012294365510600147,0.0084246915757572888,
0.0014167814812829254,-0.0077570039853174294,-0.017358751711277889,
-0.025111558407762514,-0.0285805768241776,-0.025645269967119657,
-0.014971864998229098,0.0036145568276738566,0.028946490388984458,
0.058573934531746336,0.089075046486936663,0.11657243374871724,0.13736469277031968,
0.14855499091632787,0.14855499091632787,0.13736469277031968,0.11657243374871724,
0.089075046486936663,0.058573934531746336,0.028946490388984458,0.0036145568276738566,
-0.014971864998229098,-0.025645269967119657,-0.0285805768241776,
-0.025111558407762514,-0.017358751711277889,-0.0077570039853174294,
0.0014167814812829254,0.0084246915757572888,0.012294365510600147,
0.012866146367293229,0.0106755431378323,0.0067178785267979933,0.0021603815586255671,
-0.00193093675781346,-0.0047950725846565411,-0.0060789084509289314,
-0.00583430818467503,-0.0044284390677612447,-0.0024023519489018031,
-0.00031845768496770058,0.0013670130348424061,0.0023825683282535722,
0.0026626279591927945,0.0023177424144010684,0.0015709551142810392,
0.00068204868917140081,-0.00012002668894077263,-0.00068232348448825353,
-0.00094480407039777337,-0.00093124998354411647,-0.00072233646839760571,
-0.00042165090257533178,-0.00012475869000674278,0.00010169330090088124,
0.00022807263841626016,0.00025828014307718248,0.00021865076770471255,
0.00014422074464800732,6.6768050564703366E-5,7.3839908593977014E-6,
-2.5672711408749189E-5,-3.4794861698667389E-5,-2.8460879135414476E-5,
-1.6379691026637445E-5};
float u[102];
int position=0, N=102;
float y=0;
int i, aux;
unsigned long t = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
for (i=0;101;i++)
u[i]=0.0;
position = 0;
}
void loop() {
if (millis()>=t) {
t = t + 10; // cada milisegundo
u[position]=3.3*analogRead(35)/4095;
y=0;
for (i=0;N-1;i++) {
aux = position + i;
if (aux>=N) aux = aux-N;
y=y+b[i]*u[aux];
}
position++;
if (position>=N) position = position-N;
Serial.println(y);
}
}