Opgave 4 aangepast

This commit is contained in:
2016-02-15 14:20:45 +01:00
parent 4bf8ed5b88
commit 7eb298c00a
4 changed files with 294 additions and 277 deletions
+13 -6
View File
@@ -59,6 +59,7 @@ int speed = 1;
int blink = 1000;
int b1 = 0;
int b2 = 0;
int direction = 0;
ISR(TIMER0_OVF_vect) {
@@ -107,18 +108,18 @@ int main(void)
sei();
//Alleen voor opgave 4
//PORTC = 0x1;
PORTD = 0x1;
while (1)
{
//opgave1();
//opgave2();
//opgave3();
//opgave4();
opgave4();
//opgave5();
//opgave6();
charlieplexing();
//charlieplexing();
//extraopgave();
}
@@ -167,12 +168,18 @@ void opgave4(void)
wait( 50 );
if (PORTD>= 0x80)
{
PORTD= 0x1;
direction = 1;
}
else
else if (PORTD <= 0x1)
{
PORTD = (PORTD<<1);
direction = 0;
}
if(direction)
PORTD = (PORTD>>1);
else
PORTD = (PORTD<<1);
}
void opgave5(void)