Skema rangkaian simulasi buat Robot Line Follower
Listing Prongramnya
#include <mega16.h>
#include <delay.h>
#include <alcd.h>
void main(void)
{
DDRB=0xff;
PORTB=0x00;
lcd_init(16);
lcd_gotoxy(0,0);
lcd_putsf("ROBOT LINE");
delay_ms(400);
lcd_gotoxy(0,1);
lcd_putsf("FOLLOWER");
delay_ms(400);
while (1)
{
// robot keadaan maju
PORTB.0=1;
PORTB.1=0;
PORTB.2=1;
PORTB.3=0;
delay_ms(900);
// robot berhenti
PORTB.0=1;
PORTB.1=1;
PORTB.2=1;
PORTB.3=1;
delay_ms(400);
// robot keadaan mundur
PORTB.0=0;
PORTB.1=1;
PORTB.2=0;
PORTB.3=1;
delay_ms(900);
//robot berhenti
PORTB.0=1;
PORTB.1=1;
PORTB.2=1;
PORTB.3=1;
delay_ms(400);
// robot berbelok kekanan
PORTB.0=1;
PORTB.1=0;
PORTB.2=1;
PORTB.3=1;
delay_ms(900);
// robot berhenti
PORTB.0=1;
PORTB.1=1;
PORTB.2=1;
PORTB.3=1;
delay_ms(400);
// robot berbelok kekiri
PORTB.0=1;
PORTB.1=1;
PORTB.2=1;
PORTB.3=0;
delay_ms(900);
// robot berhenti
PORTB.0=1;
PORTB.1=1;
PORTB.2=1;
PORTB.3=1;
delay_ms(400);
};
}