Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
https://www.youtube.com/watch?v=igxyP5jDE_U
you can setup Schmitt trigger with ranges for your lights
I have uploaded scheduled tutorial for large battery with display % few days ago, it will be released tomorrow, maybe I will do next tutorial with your setup.
20% jumps between colors.
And yes, I am resurrecting this as I could not find any code for this.
And yes, code is very rudimentary and not dynamic at all.
At the beginning of the program...
The 'rBattRatio' was manually calculated in this old code, these days should be able to use a load-batch (lb) command to collect the required values to extract the percentage of storage available from a bank of batteries.
The variable 'rPercent' in this case was a value between 0 and 100, this could just as easily be changed for values ranging 0 to 1, also these variable names are simply aliases for a register, so could use r0 / r1 or whatever.
This is the key part to the OP's question...
You also have Battery Mode values now. 0-6. 7 values in total.
That could be implemented to do the same job.
20% jumps have then to be from 2 to 6.
Or you could mimic what the Battery Mode value is/ do, with LED OFF when battery is dead (Mode 0), and blinking zero in red when at Mode 1. Etc.
Just some ideas.
define Battery *HashNr* (I dont know atm)
alias LED d0
alias LEDColor r15
alias BattCharge r14
Start:
move LEDColor 4
lb BattCharge Battery Ratio 0
sgt r0 BattCharge 0.25
select LEDColor r0 3 LEDColor
sgt r0 BattCharge 0.5
select LEDColor r0 5 LEDColor
sgt r0 BattCharge 0.75
select LEDColor r0 2 LEDColor
sgt r0 BattCharge 0.99
select LEDColor r0 0 LEDColor
s LED Setting BattCharge
s LED Color LEDColor
j Start
I wrote it from memory without testing because it's already late, but I think it's clear how it should work.
(keep in mind though, i have not edited the code at all, so i have no idea if it will work. But from the looks of all its functions and code at the proper places it has a fair chance of working right from the get-go.)
It even comes with an entire explanation:
You could assign the color codes to registers 0 to 4 and use another register as an index.
Kind of like you already mentioned:
r0 = color.Blue, r1 = color.Green, r2 = color.Yellow, r3 = color.Orange, r4 = color.Red
Then if you use r5 as index:
display.color = r(r5)
That eliminate values being stored that are obsolete when code run trough the loop, it also eliminate the need to 'delete' stored register that might interfere trough the < move r0 0> command, etc.
And you are only wanting one value at the time anyway.