Weather Station

Program


---

Wind vane A1

Anno A5

Rain B2

---


prog_vars =

d/count 0

d/air_temp 0.0

d/rh 0

d/press 0.0

d/light 0

d/wind_speed 0.0

d/wind_dir 0

d/at_arc 0

d/display_update_timer 0

prog_vars.


prog_start =

pclear

ptl 10 0 ^ts=35^ "Live Weather"

i2con


sctp a5

gvr a1 360 0

sctp b2

scgoff 38 1 574.0

-- Create a new Dataset for the Data

newds "met 12 Oct 2021"

-- Set the chans to include

dslc 1

dslc 5

dslc 7

dslc 35

dslc 36

dslc 37

dslc 38

-- Set the log interval to 5mins

slog 300

-- Start logging

lgon

setuct 1 25

setuct 2 5

-- Set the light update thresh to 500

setuct 35 500

-- Quit button

pb 700 10 ^n=Quit^p=exitprog^


"Setup Done"

prog_start.


prog_loop =

-- main program loop

any /display_update_timer > 100 ->

update_display

"/display_update_timer"

/display_update_timer 0

else

inc /display_update_timer

enda.

prog_loop.



update_display =


-- Display the readings

-- Air temp

round /36 2 -> /air_temp

pg 10 125 /air_temp ^id=airt^ts=24^tc=red^w=200^n=Air T^min=-10^max=40^

ptl 40 220 ^ts=20^tc=red^ "Air T /air_temp"

-- RH

/rh /37

pvl 250 150 /rh ^id=rh^lw=10^lc=blue^

ptl 240 220 ^id=rht^ts=20^tc=blue^ "RH /rh"

-- Light

mapi 0 50000 0 200 /35 -> /light

sub 200 /light -> /light

pvl 440 150 /light ^id=srad^lw=10^lc=yellow^

ptl 440 220 ^ts=20^tc=yellow^ "Light /light /35"

-- Wind Direction

sub 360 /a1 -> /wind_dir

pal 150 420 80 /wind_dir ^lw=10^lc=cyan^

ptl 150 500 ^ts=20^tc=cyan^ "Dir /wind_dir"


update_display.

prog_stop =

print "Bye"

prog_stop.