void loop() { delay(100); { //Update every one second, this will be equal to reading frequency (Hz). //Wind Vane adcWindVane = analogRead(inputWindVane); voltageWind = (adcWindVane / 1023.0) * VCC; // adc to volt voltageToDegrees(voltageWind); //Temperature celsius = dht.readTemperature(); //Humidity humidity = dht.readHumidity(); testPrintWindVane(); testPrintRain(); testPrintTemperature(); testPrintHumidity(); testPrintWindSpeed(); Serial.println(); calculating_wind_speed(); } }
float SDL_Weather_80422::current_wind_direction() { float voltageValue; float Vcc = 5.00; if (_ADMode == SDL_MODE_I2C_ADS105) { voltageValue = 0.0; } else { // use internal A/D converter voltageValue = (analogRead(_ADChannel)/1023.0)*Vcc; } float direction = voltageToDegrees(voltageValue, _currentWindDirection); return direction; }