Need some coding help please

I’m making a new watch face, but I want to use 3 (RED, YELLOW, GREEN) colors for the battery level. I have this code, but I can’t figure out how to get it to work with 3 levels and not 4. I would really really grateful for the help!!

$#BLN#>75&&#BLN#<=100?100:0$
$#BLN#>50&&#BLN#<=75?100:0$
$#BLN#>25&&#BLN#<=50?100:0$
$#BLN#>0&&#BLN#<=25?100:0$

2 Likes

Hi pinball,
For 3 levels I would use the steps 0 - 33 - 66 - 100, you can adapt them as you like
#BLN#>66?100:0$ -----> green
$#BLN#>33&&#BLN#<=66?100:0$ -----> yellow
$#BLN#<=33?100:0$ -----> red

2 Likes

@hippocampus.watches Check your Yellow Formula , try . <=66 :rofl:

2 Likes

@pinbal24 I have a cross fading 3 colour test with Formulas Basicaly composed by Peter .
.
.
Sorry this is the only thing I can find as I am on my phone at the moment .
You might have to dig a bit . But you might find some other stuff you like there .
.
.

3 Likes

definitely to early in the morning :grinning:

2 Likes

Here is another test hat might be easier to take apart . In my Collection of Published Test Faces
.
.

3 Likes

The Green color stays lit up when going through the colors. It needs to go off

2 Likes
2 Likes

Those codes were intended for image layers on top of each other . Having separate lights is different . I would make your Unlit LED a more OFF colour like mid grey . But it is your work your way .
Try this for your green LED .
.
$#BLN#>=66?100:0$
.

You have a $ missing at the beginning of your formula . You must have $$ or ( ) beginning and end . Check the number top right above the Field box . If you have a formula in it there should be a number . No Number NOP .
Excuse me @hippocampus.watches for diving in . I have lust come in to have lunch from some Gardening ( Weed Pulling ) . I needed to be Nosey .

2 Likes

It is working properly now, thank you. And it works side-by-side in my watch face. Thank you

2 Likes