Challenge

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);

}

}

}

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.