// modulo demo
void setup() {
Serial.begin(115200);
uint16_t testVal = 5;
uint16_t countsToGo = 0;
Serial.println("compare\t counts\t\ti\ttestVal\n----------------------");
for (uint16_t i = 0; i < 11; i++) {
if (i <= testVal) {
countsToGo =testVal - i;
Serial.print("les \t\t");
Serial.print(countsToGo);
Serial.print("\t");
Serial.print(i);
Serial.print("\t");
Serial.println(testVal);
}
else {
countsToGo = (testVal - i) % testVal;
Serial.print("grt or equ \t");
Serial.print(countsToGo);
Serial.print("\t");
Serial.print(i);
Serial.print("\t");
Serial.println(testVal);
}
}
}
void loop() {
// put your main code here, to run repeatedly:
}