top of page

Raspberry Pi Shake Test Program 2 Aug 2021

This is a test program. It plots the data on two charts.

Program


---

Raspberry Pi Shake Test Program

---


prog_vars =

d/count 0

d/xpos 0

d/pro_EHZ 0.0

d/prev_EHZ 0.0

d/pro_EHZ_max 0.0

d/prev_EHZ_max 0.0

d/range_EHZ 0.0

prog_vars.


prog_start =

pclear

d1000

-- Display the Title.

ptl 100 -15 ^ts=24^tc=blue^ "Raspberry Shake Alert Program"


-- Add Quit Button

pb 25 50 ^n=Quit^p=exitprog^

prog_start.


prog_loop =

-- main program loop

inc /count

-- Stop after 10,000 readings

any /count >= 10000 -> exitprog

any /count >= 3 ->

-- grsk AM.R5C47 -- TKMP

grsk AM.R7DD4 -- Pcol

d500

-- d-trend the reading

sub /rs_EHZ /prev_EHZ -> /pro_EHZ

-- Invert the negative values

abs /pro_EHZ -> /pro_EHZ

sub /rs_EHZ_max /prev_EHZ_max -> /pro_EHZ_max

abs /pro_EHZ_max -> /pro_EHZ_max

sub /rs_EHZ_max /rs_EHZ_min -> /range_EHZ

abs /range_EHZ -> /range_EHZ

d/title "My Graph Title"

-- Plot the pro_EHZ geophone value

plot 10 100 ^id=rs^n=/title^t1n=EHZ^t2n=Max^xdp=100^xp=/xpos^v1=/pro_EHZ^v2=/pro_EHZ_max^

plot 10 400 ^id=ra^t1n=EHZ^t2n=Max^xdp=100^xp=/xpos^v1=/rs_EHZ_max^v2=/range_EHZ^

-- Display the plot value

ptl 30 20 ^ts=16^ "X /xpos > EHZ /rs_EHZ pro EHZ /pro_EHZ max /pro_EHZ_max"

-- Check for a Quake

any /pro_EHZ >= 500 ->

-- YES we have a quake

ptl 100 40 ^ts=25^tc=red^ "Tapapa Hopukina Kia mau"

else

-- NO no quake

ptl 100 40 ^ts=25^tc=Lime^ "OK"

enda.

-- Next Xpos

inc /xpos

enda.

-- Update the previous value.

/prev_EHZ /rs_EHZ


/prev_EHZ_max /rs_EHZ_max


prog_loop.


jack =

tg l1

jack.


prog_stop =

ptl 525 5 ^ts=75^ "Bye"

prog_stop.



bottom of page