void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer // Set both clocks to 1MHZ BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; // Initialize ports & hardware initLEDs(); initKeypad(); initPWM_TA0(); initPWM_TA1(); __bis_SR_register(GIE); // Enable interrupts while(1){ unsigned int i, j; for (i = 0; i < 4; i ++){ // find row of pressed button P1OUT |= muxRow[i]; // set P1OUT to current test for (j = 0; j < 4; j ++) { // find column of pressed button if ((P2IN & 0xFF) == cols[j]){ // yay! we found the button cmdVal = commands[j][i]; moveServos(cmdVal); } }// end for(col) P1OUT &=~ muxRow[i]; // reset P1OUT for next test } // end for(row) } // end while(1) } // end main()
void Zowi::jump(float steps, int T){ int up[]={90,90,150,30}; moveServos(T,up); int down[]={90,90,90,90}; moveServos(T,down); }