Blinking Image for low battery

good evening everyone. I have a little problem that you can certainly help me with. I have an image as a low power indicator with the tag $ # BLN # <20? 100: 0 $ how can I make it blink? The frequency doesn’t matter.

thank you in advance
Mattes

This formula should do the trick:

$#BLN#<=20&&#BLN#>=0?(100*(sin(((#DWE#/0.5-(floor(#DWE#/0.25)))2pi)))):0$

Hi phantasico
no unfortunately does not work

Oh, yes, i forgot the spaces…

This is the right one:

$ #BLN#<=20 && #BLN#>=0? (100 * (sin(((#DWE# / 0.5-(floor(#DWE# / 0.25))) * 2 * pi)))) : 0$

No sorry no red colour and no blinking

I mean the image is not displayed and so of course it cannot blink

Hmmm - can´t be …

i do use exactly this formula in one of my watch faces …

$ #BLN#<=20 && #BLN#>=0? (100 * (sin(((#DWE# / 2-(floor(#DWE# / 1))) * 2 * pi)))) : 0$

now i have copied it from your watch and it works.
Thanks alot.
you are really fantastic

You´re welcome. Glad that it´s working for you now.

I think it was only a display problem here in the community fields.

Greetz, GAUSS.

Hello @mattesnau and @phantasico, I’m new, and was wondering where I put the code. Let me know! Thanks

You paste the code in the opacity line on the right side, when you open the additional window with the small rocket below.

Alternatively you could use the squareWave () function.
This does most of the work for you to get the blinking effect (combined with a conditional statement as provided by @phantasico of course to only trigger the effect when battery is low) :slight_smile:
See Expressions | Facer Documentation.

I used (squareWave(#Dsm#,100,1,0)) in the opacity field for my beer glass face to blink the colon between the hours & minutes (web preview depends on your browser and machine, so does not always look nice, but it works 100% as intended on the watch).
Actually I am alternating it between white and orange, each colour displaying for half a second, so am using 2 layers, with out of phase square waves.
The face is open for inspection if you want to have a look.

PS: I am a relative noob to Facer, so don’t assume that all in my faces is best practice.
The experts are welcome to correct me where required and/or comment on my faces with suggestions to improve (excluding my graphics - I know that is bad… :wink: )

1 Like

Haha, looks great!

Hi @phantasico

Is it also possible to made the image appears only when it reaches its low batter threshold.

You mean have the blinking image (layer) only visible under specific conditions?

If the expression provided above:
$ #BLN#<=20 && #BLN#>=0? (100 * (sin(((#DWE# / 2-(floor(#DWE# / 1))) * 2 * pi)))) : 0$
is placed in the opacity field, it should do that.
i.e. the layer will only show (blinking) if battery level is between 0 and 20 %
else the opacity will be 0 and thus the image will not show.

Just to feedback on this issue. I did exactly as mentioned above, but the image (layer) is still visible at all times and does not blink when it reaches the low battery threshold. However, the image did not show up in the Face Creator itself. Queer. Or is there other things I need to do as well.

Hi

A while back @mikeoday helped me with the blinking battery feature
I use one of these two formulas in the opacity field:

  • $#BLN#<=15?(1*sin(#DWFSS#, 0, 2, 2)*100):0$
  • $#BLN#<=15?((floor(#DNOW#/1000)%2)*100):0$

These formulas will make it flash at 15% every 1 second, change the “15” for a different percentage
In the second formula; the “1000” will make it flash every 1 second, for slower increase the 1000 value

Ihope this is what you are looking for

2 Likes

Hi @ozarour
I tried both formulas. Appears that only the 2nd formula $#BLN#<=15?((floor(#DNOW#/1000)%2)*100):0$ works for me. Anyway, Many Thanks.

Glad to hear it works… you are welcome

Hello Phantasico,
I see that you use “&&” for “and” condition. If I am not wrong, this is not mentioned in the Facer documentation. As I din’t know that (I am quite new to Facer); I was struggling to obtain a double condition, using 2 embedded conditions “if… then…”.
Can you tell me if we also have as well an “or” condition, and what it is?
If it is not in the documentation, it would be great to add it (unless I miss it, if so, sorry for this post).
Thanks