Project 1 - Controlling a DC motor using PWM and monitoring its Running status
OFFLINE:
#include <avr/io.h>
#define F_CPU 1600000000L
#include <util/delay.h>
int main(void)
{
/* Replace with your application code */
DDRA |=(1<<2);
DDRC &=(1<<4);
PORTC |=(1<<4);
while (1)
{
if(PINC | 0X00)
{
PORTA &=~(1<<2);
_delay_ms(5);
}
else
{
PORTA |=(1<<2);
_delay_ms(5);
}
}
}