Anonymous
public c v1 · immutablechar changes;oldbuttons = 0; while(1) { // if one works out the math, bits there are left, changed, // and are now 0 if ((changes = ((PINA ^ oldbuttons) & oldbuttons)) != 0x00) { if (changes & 0x01) control++; // button 1 if (changes & 0x02) control--; // button 2 lcdGotoXY(0,1); // Char 1, LCD Line 2 rprintf("Control %d ",control); oldbuttons = PINA; } error = position - control; if (error > 255) error = 255; if (error < -255) error = -255; SetSpeed(error); }