Brilliant students of YRC: Ved Soman

Ved Soman joined the LEVEL-2 course of YANTRAM ROBOTICS CLUB on 24 June, 2015. I taught him the basic hardware of the robotic kit given to him. Then in the evening batch I taught him the basics of embedded programming. And on the same day, to my surprise, he developed this program (given below) with systematic logical thinking, as to control the two motors connected to PB4-PB1 through two simple IR sensors in his robotic kit of ATMega8 MUC.

Ved just passed 10th standard and planning to take admission in Poly with Mechanical trade. He has the peculiarity of learning with keen attention and has good logical thinking abilities.

Join him on his Facebook profile.

The YashPlus Team & YRC wish him all the best…!

Ved Soman’s code of BLFR

/*	This project is written by Ved Soman
	Program of Black Line Following Robot 
	using ATMega8 microntroller robotic kit

	====== For further details about our robotics training
	====== visit our website at: www.yashplus.com
*/

#define F_CPU 12000000UL
#include <avr/io.h>
#include <util/delay.h>

int main()
{
DDRB=0b00011110;
DDRC=0b0000000;
DDRD=0b00010000; // output pin for buzzer
int s;
// user defined functions
void Forward()
	{
		PORTB=0b00010010;
	}

void Backward()
	{
		PORTB=0b00001100;
	}

void Stop()
	{
		PORTB=0b0000000;
	}

void SoftLeft()
	{
		PORTB=0b00000010;
	}

void SoftRight()
	{
		PORTB=0b00010000;
	}

void PowerRight()
	{
		PORTB=0b00010100;
	}

void PowerLeft()
	{
		PORTB=0b00001010;
	}

	while(1)
	{
	s=PINC&0b0001001;

	if(s==9) // both sensors are on white
	{
		Forward();
	}
	else if (s==8) // LS is on white, RS is on black
	{
	
		SoftRight();
			PORTD=0b00010000;
		_delay_ms(60);
		PORTD=0b00000000;
	}

	else if(s==1) // LS is on black, RS is on white
	{
		SoftLeft();
			PORTD=0b00010000;
		_delay_ms(60);
		PORTD=0b00000000;
	}

	else // both sensors are on black 
/* You can see that how effectively he used the 'else' condition here. */
	{
		Stop();
	}
}
}

Read more about GREAT ACHIEVEMENTS of our students of robotics. Click here to read more articles.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.