![sparkfun DEV-14153 Скачать руководство пользователя страница 18](http://html1.mh-extra.com/html/sparkfun/dev-14153/dev-14153_hook-up-manual_1339605018.webp)
}
}
}
//
Keep
track
of
when
the
last
tick
came
in
on
the
wind
senso
r.
void windTick(void)
{
timeSinceLastTick
= millis()
lastTick;
lastTick
= millis();
}
//
Capture
timestamp
of
when
the
rain
sensor
got
tripped.
void rainTick(void)
{
rainTickList[rainTi+]
= secsClock;
if (rainTickIndex
== NO_RAIN_SAMPLES)
rainTickIndex
= 0;
ra+;
}
//
For
the
purposes
of
this
calculation,
0deg
is
when
the
win
d
vane
//
is
pointed
at
the
anemometer.
The
angle
increases
in
a
clo
ckwise
//
manner
from
there.
void windDirCalc(int vin)
{
if
(vin
< 150)
windDir="202.5";
else if (vin
< 300)
windDir
= "180";
else if (vin
< 400)
windDir
= "247.5";
else if (vin
< 600)
windDir
= "225";
else if (vin
< 900)
windDir
= "292.5";
else if (vin
< 1100)
windDir
= "270";
else if (vin
< 1500)
windDir
= "112.5";
else if (vin
< 1700)
windDir
= "135";
else if (vin
< 2250)
windDir
= "337.5";
else if (vin
< 2350)
windDir
= "315";
else if (vin
< 2700)
windDir
= "67.5";
else if (vin
< 3000)
windDir
= "90";
else if (vin
< 3200)
windDir
= "22.5";
else if (vin
< 3400)
windDir
= "45";
else if (vin
< 4000)
windDir
= "0";
else windDir
= "0";
}
Note:
When connecting to a WiFi network and the Wunderground
server, make sure to modify the variables
ssid
,
password
,
ID
, and
key
.
Expected output
Here is a picture of what you should expect upon starting up your ESP32
and letting it connect to WiFi:
Page 18 of 20