Mam tak i działa na monitorze portu ładnie wyświetla obroty:
Code: Select all
void Anemometr(){
cnt= cnt+1;
if (digitalRead(am)==NULL){ //I've checked that on free position anemometer is always closed
delay(2);
stan=!stan;
while (digitalRead(am)==NULL) ;
rot=rot+1 ;
}
if (cnt==100){
wind = rot*2.40114;///5; //equation calculating average speed of the wind in 3 sec intervals
Serial.println(rot);
Serial.print("Wind speed = ");
Serial.print(wind, 2);
Serial.println(" km/h");
cnt=0; //counter reset
rot=0; //rotation number reset
}
delay(8); //this delay is put here to extend time of whole loop to 10ms
}Code: Select all
void loop() {
SuplaDevice.iterate();
DisplayTemp();
Anemometr();
}jak wartość "wind"
przekazać do :
Code: Select all
double get_wind(int channelNumber, double wind) {
???????
}