Mikro Percobaan 4 Modul 3
3. Flowchart [kembali]
#include <mega128.h>
#include <delay.h>
int pin[]={1,2,4,8};
int i;
void putar()
{
for(i=4;i>=0;i--)
{
PORTD = pin[i];
delay_ms(300); }
}
void main(void){
PORTA = 0X00;
DDRA = 0X00;
PORTD = 0X00;
DDRD = 0XFF;
while(1)
{
if (PINA.2 == 1)
{
putar();
}
}
}
5. Video [kembali]#include <delay.h>
int pin[]={1,2,4,8};
int i;
void putar()
{
for(i=4;i>=0;i--)
{
PORTD = pin[i];
delay_ms(300); }
}
void main(void){
PORTA = 0X00;
DDRA = 0X00;
PORTD = 0X00;
DDRD = 0XFF;
while(1)
{
if (PINA.2 == 1)
{
putar();
}
}
}
6. Kondisi [kembali]
Memutar motor kearah kanan
7. Link Download [kembali]
Komentar
Posting Komentar