Bonjour ,
Je suis en train de faire un code pour asservir la vitesse d'un bateau et j'ai un soucis dans mon code avec l'erreur
Invalide use of non-static member function, j'ai utilisé la bibliothèque Simpletimer , je ne comprend pas ce qui ne marche pas,
#include <SimpleTimer.h>
const int switchPin = 2;
const int motorPin = 11;
int switchState = 0;
const int RL = 7;
int RecepLaser;
int Compteur;
int consigne;
int VM;
SimpleTimer timer;
int setTimer;
unsigned long time;
int f;
int k;
int timerId;
void asservissement(){
f=(Compteur*3)/3;
if (f<consigne) {
k=consigne/f;
analogWrite(motorPin, VM*k);
Compteur=0;
}
}
void setup() {
pinMode(motorPin, OUTPUT);
pinMode(switchPin, INPUT);
pinMode(RL, INPUT);
timerId = timer.setTimer(3000, asservissement, 5);
Compteur=0;
consigne =0.5;
VM=127;
time = millis();
timer.run; // erreur : invalide use of non-static member function
}
void loop() {
delay(10000);
while (time<30000)
{
analogWrite(motorPin , VM);
RecepLaser = digitalRead(RL);
if (RecepLaser == HIGH){
Compteur=Compteur+1;
}
else {
Compteur=Compteur;
}
}}
Merci de m'aider

je ne comprend pas