I developed a storm warning system with a colorful / flashy alert. In this manual, I will describe in detail what needs to be done and attach a copy of my code for the microprocessor.
What we need?
2. Wires
3. Socket
4. Microprocessor
5. A computer
6. Motherboard for programming
7. LCD display 2 pieces
8. flashing light bulb
9. Speaker
What does the scheme look like?
Naturally, this is all connected to the weather station.
An important and not obvious setup! After that, how do you assemble the whole circuit, be sure to check, is the weather station turned on! She can turn off, when you were laying the cable and when laying the cable, a circuit break could occur!
What's in the code and how it all works?
The weather station has several modes of operation:
0 – no storm
1 – the storm is coming
2 – the storm is coming
Accordingly, I connected the operating modes of the weather station with LCD displays, Loudspeakers and flashing lamp.
The loudspeaker has a LOT of operating modes, which can be used. He can play 12 various alarms, three melodies and 30 voice messages. You can familiarize yourself with each mode of operation on VICKY[stationeers.fandom.com]
What I've done?
I connected two LCD displays. When there is no storm, they show that there is no storm))) Obviously)))
When a storm approaches, the LCD will show this.
And the magic begins, namely:
1. The timer starts and the countdown starts
2. Flashing light turns on
3. Loudspeaker includes multiple voice announcements:
(speaker) 3.1. Attention the storm begins
(speaker) 3.2. Valkyrie flight on (my favorite part)
When there are a few seconds left on the timer
The loudspeaker turns on another script and it starts counting the last seconds, and the LCD starts the last countdown at 5 seconds.
And then the storm starts
LCD displays turn red, loudspeaker turns on the siren, and the flashing light continues to work.
Please note that the upper display is a timer and the lower one is the operating modes of the weather station, which I described above!
Of course, in any incident and at any stage, you can change both the color of the displays, and change the voice alerts on the loudspeaker.
Cote da Vinci
define display2 -53151617
define lamp -1535893860
define speaker -828056979
define dispTime2 -53151617
alias MeteoStation d0
alias Display d1
alias dispTime2 d2
alias Lamp d3
alias speaker d4
alias on r4
move on 1
move r5 0
storm:
l r1 d0 Mode
s d1 Setting r1
l r2 d0 NextWeatherEventTime
s d2 Setting r2
beqz r1 nostorm
beq r1 1 stormcoming
beq r1 2 stormnow
yield
j storm
nostorm:
s d1 Color 2
s d2 Color 7
s d3 On 0
s d4 On 0
j storm
stormcoming:
s d2 Color 5
s d1 Color 5
s d3 On on
s d4 On on
s d4 Volume 100
bne r5 7 big head
blt r2 7 coultdown
j storm
big head:
s d4 Mode 16
sleep 3
s d4 Mode 18
sleep 3
s d4 Mode 7
l r5 d4 Fashion
j storm
stormnow:
s d2 Color 4
s d1 Color 4
s d3 On on
s d4 On on
s d4 Volume 100
s d4 Mode 12
move r5 0
j storm
wait:
l r1 d0 Mode
beq r1 1 wait
bne r1 1 storm
coultdown:
s d2 Setting 5
s d4 Mode 33
sleep 1
s d2 Setting 4
s d4 Mode 32
sleep 1
s d2 Setting 3
s d4 Mode 31
sleep 1
s d2 Setting 2
s d4 Mode 30
sleep 1
s d2 Setting 1
s d4 Mode 29
sleep 1
j wait
Code explanation
(circled in red – these are tags)
SO…
If you want to change the sounds on the speaker, then you need to make changes, to the D4 socket channel, since D4 – it's a loudspeaker
for example:
s d4 Volume 100 means set the loudspeaker to maximum volume
or another example:
s d4 Mode 12 means to set the sound of Alarm10 to the loudspeaker
(as I said above, the entire loudspeaker specification can be read in VICKY[stationeers.fandom.com]
Summarizing
And the most important thing, this script describes the work only for:
- 2 LCD display
- 1 speaker
- 1 flashing lamp
If this manual is required, then I will finish the code and it will work with any number of devices. Though 50 loudspeakers or 200 flashing lights and a thousand displays (figuratively speaking).
Leave a Reply