What does the % caracter mean

Hi, What does the % caracter mean? I have this code snippet

if (buttonPushCounter % 4 == 0) {
    digitalWrite(ledPin, HIGH);
  } else {
   digitalWrite(ledPin, LOW);
  }

But can’t find the meaning of the % part. Google seems to ignore the % in search commands…

Thanks, Chris

http://arduino.cc/en/Reference/Modulo

Try looking in the Reference section when you see unknown code being used.
http://arduino.cc/en/Reference/Modulo

Alright! http://arduino.cc/en/Reference/HomePage Just what i needed. Thanks guys.

Chris

Yep, it's that old "teach a man to fish" thing going on ...

"teach a man to fish"

...and he'll sit in a boat all day with his mates, drinking beer.

8)

AWOL:

"teach a man to fish"

...and he'll sit in a boat all day with his mates, drinking beer.

Say the guy has several packs of beer, 6 per pack. He takes one beer at a time. The beer left in the most recent pack is only between 0 and 6 so it represents total_beer%7.

Say the guy has several packs of beer, 6 per pack. He takes one beer at a time. The beer left in the most recent pack is only between 0 and 6 so it represents total_beer%7.

Aha, Now I understand modulo, never expected beer could clear things up…

Chris

ElectricalStorm: :%

Aha, Now I understand modulo, never expected beer could clear things up…

Chris

Beer can help you realize the earth is rotating too. :cold_sweat: