DC motor controlled using L239D motor driver IC with ATMEGA328


#include <avr/io.h>
#include <util/delay.h>

int main(void)
{

    //control pins
    DDRB|= 1<<PB0; //D1 on L293D 
    DDRB|= 1<<PB1; //D2 on L293D
  
    while(1)
    {

      //Rotate in clockwise direction
      PORTB&=~ (1<<PB0);
      PORTB|= 1<<PB1;
      _delay_ms(2000);

      
      //Rotate in anti-clockwise direction
      PORTB|=  1<<PB0;
      PORTB&=~ (1<<PB1);
      _delay_ms(2000);

    }
}


About PraveenMax
My Interests: ------------------ Programming , Drawing & Music

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: