Sunday, February 12, 2012
On 6:42 PM by MILANO No comments
The following video show the edge detection robot implemented using ATmega16 and two Analog IR sensors. The Robot uses two geared motor and one caster wheel at the front for the movement. The robot uses Ablab ATK-500 AVR trainer board. Motor driver is use to drive motor.
The code is shown below.
//PORTC is used for LED
//PORTD is used for motor driver
//PORTA for ADC channel input
#include<avr/io.h>
#include<util/delay.h>
#include"adc.h"
void main()
{
PORTD=0xff;
PORTC=0xff;
adc_init();
unsigned int x,y;
while(1)
{
x=read_adc_channel(0);
y=read_adc_channel(1);
if(x>150&&y<150)
{
PORTC=0xf0;
;
PORTD=0x09;//Left turn
}
else if(x<150&&y>150)
{
PORTC=0x0f;
PORTD=0x06;//Right TUrn
}
// for both sensor outside the table
else if(x>150&&y>150)
{
PORTD=0x09;
_delay_ms(3000);
PORTC=0b11000011;
}
else if(x<150&&y<150)
{
PORTD=0x05;//Forward Motion
PORTC=0b00111100;
}
}
}
#include<util/delay.h>
#include"adc.h"
void main()
{
PORTD=0xff;
PORTC=0xff;
adc_init();
unsigned int x,y;
while(1)
{
x=read_adc_channel(0);
y=read_adc_channel(1);
if(x>150&&y<150)
{
PORTC=0xf0;
;
PORTD=0x09;//Left turn
}
else if(x<150&&y>150)
{
PORTC=0x0f;
PORTD=0x06;//Right TUrn
}
// for both sensor outside the table
else if(x>150&&y>150)
{
PORTD=0x09;
_delay_ms(3000);
PORTC=0b11000011;
}
else if(x<150&&y<150)
{
PORTD=0x05;//Forward Motion
PORTC=0b00111100;
}
}
}
Subscribe to:
Post Comments (Atom)
Search
Popular Posts
-
SMART HOME AUTOMATION BY: Bishwas Kc, Manoj Ghimire, Milan Shrestha and Raj Silwal ...
-
This video shows an Obstacle Detector and Avoid-er implemented using ATmega16 and two LDR sensors. This Robot can detect the obsta...
-
Recently I've share about Google form integration in DDC Dolakha website, and thought I'd write a short blog for anyone who is inte...
-
The following video show the edge detection robot implemented using ATmega16 and two Analog IR sensors. The Robot uses two geared mot...
-
figure: Smart Home Automation Cover This Power Point presentation present the defence of SMART HOME AUTOMATION, our final year proj...


0 comments:
Post a Comment