Stepper with ATmega32A
Share
Thanks for the push button code and ADC examples Patrick. Your website motivated me to transition from Arduino and Intel Edison (in mraa) to the real deal. Best wishes, Jordan
//This is the basic running function void go(struct stepPins* myStepper) { if (TIFR & (1 << OCF1A)) { if (myStepper->step%4== 1) { motorPORT = myStepper-> F1; } else if (myStepper-> step%4 == 2) { motorPORT = myStepper-> F2; } else if (myStepper->step%4 == 3) { motorPORT = myStepper-> F3; } else if (myStepper->step%4 == 0) { motorPORT = myStepper-> F4; myStepper->fourthStep = '1'; myStepper-> step=0; } myStepper->step= myStepper->step+1; TIFR = (1 << OCF1A); // Clear the CTC Flag by writing a logic 1 to it myStepper->stepCount = (myStepper->stepCount)+1; } }