4 changed files with 14086 additions and 35 deletions
@ -1,34 +0,0 @@ |
|||||
|
|
||||
void getWind() { |
|
||||
|
|
||||
windDirection = ""; |
|
||||
anemometerVal = digitalRead(anemometerPin); |
|
||||
|
|
||||
if ((anemometerState == 1) && (anemometerVal == 0)) { |
|
||||
anemometerDuration = millis() - startime; |
|
||||
startime = millis(); |
|
||||
windSpeed = 2500.0/anemometerDuration; |
|
||||
} |
|
||||
|
|
||||
anemometerState = anemometerVal; |
|
||||
|
|
||||
if(millis() >= timer) { |
|
||||
Serial.println("--------------------------"); |
|
||||
Serial.println("Sending..."); |
|
||||
timer = millis() + timerLimit; |
|
||||
|
|
||||
if(digitalRead(northPin)) {windDirection = windDirection + "N";} |
|
||||
if(digitalRead(southPin)) {windDirection = windDirection + "S";} |
|
||||
if(digitalRead(eastPin)) {windDirection = windDirection + "E";} |
|
||||
if(digitalRead(westPin)) {windDirection = windDirection + "W";} |
|
||||
|
|
||||
if(printSensorsData) { |
|
||||
Serial.print("Wind speed:\t"); |
|
||||
Serial.print(windSpeed); |
|
||||
Serial.println("Km/h"); |
|
||||
Serial.print("Wind direction:\t"); |
|
||||
Serial.println(windDirection); |
|
||||
} |
|
||||
sendRequest(); |
|
||||
} |
|
||||
} |
|
After Width: | Height: | Size: 289 KiB |
After Width: | Height: | Size: 459 KiB |
Loading…
Reference in new issue