Hi;I have a motor.c code in which pin 13 and 14 are set\used for clockwise and anti-clockwise direcion as original firmware. I want to use only one pin 14 for DIR and then set the values to HIGH and LOW for clockwise and anti-clockwise direction.
I attached the original code below.
Please tell me how to use the lines below in original code.
I attached the original code below.
Please tell me how to use the lines below in original code.
Rich (BB code):
#undef F_CPU
#define F_CPU 1000000UL
#include <avr/io.h>
#include <util/delay.h>
int main(void) {
DDRB = (1 << 2);
while(1) {
PORTB |= (1 <<2);
_delay_ms(200);
PORTB &= ~(1 << 2);
_delay_ms(200);
}
}
Attachments
-
1.2 KB Views: 24
Last edited: