eebhoi01
Advanced Member level 4
Hello Everyone!
Pleas let me know how should I write so that the increment would be by 2. I understand that this code will increment the value of cnt++ by one up to 255. Help me make it by two's please, THanks
Pleas let me know how should I write so that the increment would be by 2. I understand that this code will increment the value of cnt++ by one up to 255. Help me make it by two's please, THanks
if (kp != oldstate) { // Pressed key differs from previous
cnt = 1;
oldstate = kp;
}
else { // Pressed key is same as previous
cnt++;
}
Lcd_Chr(1, 10, kp); // Print key ASCII value on LCD
if (cnt == 255) { // If counter varialble overflow
cnt = 0;
Lcd_Out(2, 10, " ");
}
WordToStr(m, txt); // Transform counter value to string
Lcd_Out(2, 10, txt);