Stationeers: Storm warning system

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?

1. weather station
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?

Everything is very simple, connecting everything to each other. This screenshot shows the principle of connection, when “VOLTAGE” and “LOGIC” comes with one cable. Naturally, if you want maximum perfectionism, you can do it “LOGIC” put separately and “VOLTAGE” separately, be careful!

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?

Describe how our system 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 MeteoStation 1997212478
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

I will not describe the logic in detail, who fumbles, he fumbles. And who does not fumble, I'll just say. The code describes 7 tags, on which transitions occur every cycle.

(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

I checked this code several times., everything is working. Keep in mind, if you make changes to the logic of the loops, then I do not guarantee that the script will not break. Be very careful, if you change something.

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).

From AlexVJ

Be the first to comment

Leave a Reply

Your email address will not be published.


*