Stormworks: Build and Rescue

Stormworks: Build and Rescue

82 ratings
Radial / Bar Segments as Gauge - Easiest Way
   
Award
Favorite
Favorited
Unfavorite
Tags: v0.6.14
File Size
Posted
Updated
20.901 KB
Mar 23, 2019 @ 9:37pm
Mar 24, 2019 @ 7:13am
3 Change Notes ( view )

Subscribe to download
Radial / Bar Segments as Gauge - Easiest Way

Description
This is a Microcontroller I made for a Video about the 0.6.14 Update and i've made a Number to Gauge version for Steam Workshop.

If you need, i made a test with this microcontroller here : https://steamcommunity.com/sharedfiles/filedetails/?id=1691997260


Updated Version

Now with a Passthrough Input you can use to chain other microcontroller and connect to many chained Instrument Panels




You can delete this Input if not needed to make this chip smaller.


How it works



First part is there to scale the input value to 8, because there is 8 segments on Radial or Bar Displays.

This is simply done by dividing 8 by the Maximum Value and by multiplying this to the inputted value.


Then...



This function is :

(2^x)-1

Because each segment (With Number (bits) Setting) represents a binary weight like this :



...if you want many segments to goes ON, you simply need to add each weight of which segments you need.

For example, for the two first segment, 1 + 2, so you'll have to input a 3.

And etc... for any segment you need... 1 + 2 + 4 + 8 + 16 for the first 5 segments....


2^x is here to return, in decimal, the value of each weight.

2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16
2^5 = 32
2^6 = 64
2^7 = 128
2^8 = 256

and i decrease this value by 1 to obtain a full 1 binary number, like this :

(In Binary)
2^0 - 1 = 0 (0)
2^1 - 1 = 1 (1)
2^2 - 1 = 11 (3)
2^3 - 1 = 111 (7)
2^4 - 1 = 1111 (15)
2^5 - 1 = 11111 (31)
2^6 - 1 = 111111 (63)
2^7 - 1 = 1111111 (127)
2^8 - 1 = 11111111 (255) - 8 segments to ON


I hope this will help some people... and if you didn't understand any of this heavy weighted text.... don't worry and just download this microcontroller, it will make the job for you ;)
17 Comments
Birb Feb 2, 2024 @ 3:05am 
I feel like i've learned the whole computer engineering course while reading this 😂
♥♥♥♥ nvidia Apr 29, 2023 @ 6:48pm 
(2^x)-1 is the most helpful thing ive seen today
Raz Feb 10, 2022 @ 11:36am 
Hey man, thanks for this microcontroller, really helps and works most of the the segment I have been trying to implement. Been using the threshold method and most of the time it just didnt work.
-Crusader Apr 29, 2021 @ 8:38am 
but cant figure out how to add that*
-Crusader Apr 29, 2021 @ 8:37am 
im having a little bit of trouble with this it works great but i want to add a min level to set a range between min and max but figure out how to add that
Dr.Convenient Aug 6, 2020 @ 11:19am 
10/10 you saved my soul
rogueknight May 4, 2020 @ 6:35pm 
ep084759 it took me awhile to figure out. Create another input and do the same math functions. Change the composite writer to 2 channels and start at one (instead of variable). Plug the results of each function into the corresponding channel.
ep084759 Apr 21, 2020 @ 5:44pm 
I've been stuck for 2 days, I cant figure out how to have two seperate bar segments on the same instrument panel that will react to different channels
MonkeyKing73 Dec 23, 2019 @ 10:14pm 
still the easy way?
Catmandoe1 May 20, 2019 @ 12:28am 
i've done one of this with my dad and its basicly the same!(i guess theres only one way to make it!)