Cet article a été entièrement réécrit, mis à jour et fortement amélioré, la nouvelle version est disponible sur Carnet du Maker : https://www.carnetdumaker.net/articles/faire-une-barre-de-progression-avec-arduino-et-liquidcrystal/
N.B. Les commentaires de l’article ont été pris en compte lors de la rédaction des nouveaux articles 😉
Parfait et merci ! pile ce qu’il va me falloir à reception du shield (via DX).
Publié par David | 13 juillet 2012, 22 h 30 minAdapter dans la mise en route de mon projet d’alarme de maison 😉
Merci
Publié par Rodolphe | 22 février 2013, 15 h 56 minhallo. I’m sorry I can’t speak French… hopefully you’ll understand me as well. Anyway, you could answer in French, I can understand it.
First, my congratulations… your job is brilliant!
Just I can’t understand this line:
/* Dessine les cases vides restantes */
for(i = 0; i < 16 – (cp + (cl ? 1 : 0)); ++i)
because I don't know the meaning of the "?" and of the ":" operators.
It works, but i cannot find an explanation of how ? and : work in the sketch.
Could you be so kind to help me out? (any hint of where I can find the documents is also wellcome).
Many thanks in advance
Ale
Publié par Alessandro Budica | 23 octobre 2013, 16 h 32 mincp is the number of full square.
cl is the number of black columns in the last « not totally blank » square.
i is a iterator variable for all loops.
At most all squares can be blank (0%), in this case cp = 0 and cl = 0.
So the inline if statement : « cl ? 1 : 0 » is false because cl is zero.
cp + 0 = 0 + 0 = 0
16 – 0 = 16
The loop draw 16 empty squares.
If all square are full or blank the inline if statement remain false.
The loop draw 16 – cp blank squares.
But if there is a « not totally blank » square ?
The inline if statement become true so the loop draw 16 – cp – 1 blank squares.
The « – 1 » here is for the « not totally blank square » draw before.
PS: by writing this I think I’ve made a mistake in the code.
Just drawing 15 – cp blank square all time should work.
Publié par skywodd | 23 octobre 2013, 19 h 45 minmerci bien… everything is clear!
Publié par Alessandro Budica | 25 octobre 2013, 0 h 31 min