Stormworks: Build and Rescue

Stormworks: Build and Rescue

83 个评价
Radial / Bar Segments as Gauge - Easiest Way
2
   
奖励
收藏
已收藏
取消收藏
标签: v0.6.14
文件大小
发表于
更新日期
20.901 KB
2019 年 3 月 23 日 下午 9:37
2019 年 3 月 24 日 上午 7:13
3 项改动说明 ( 查看 )

订阅以下载
Radial / Bar Segments as Gauge - Easiest Way

描述
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://psteamcommunity.yuanyoumao.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 条留言
Анальный дебошир 2024 年 2 月 2 日 上午 3:05 
I feel like i've learned the whole computer engineering course while reading this 😂
Random 2023 年 4 月 29 日 下午 6:48 
(2^x)-1 is the most helpful thing ive seen today
Raz 2022 年 2 月 10 日 上午 11:36 
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 2021 年 4 月 29 日 上午 8:38 
but cant figure out how to add that*
-Crusader 2021 年 4 月 29 日 上午 8:37 
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 2020 年 8 月 6 日 上午 11:19 
10/10 you saved my soul
rogueknight 2020 年 5 月 4 日 下午 6:35 
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 2020 年 4 月 21 日 下午 5:44 
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 2019 年 12 月 23 日 下午 10:14 
still the easy way?
Catmandoe1 2019 年 5 月 20 日 上午 12:28 
i've done one of this with my dad and its basicly the same!(i guess theres only one way to make it!)