Willkommen auf unserem Seminar-Blog

Immer auf dem aktuellen Stand bleiben

Dieser Seminar-Blog befindet sich noch im Aufbau und wird in den kommenden Tagen entsprechend verfeinert.

Member Login

Lost your password?

Registration is closed

Sorry, you are not allowed to register by yourself on this site!

You must either be invited by one of our team member or request an invitation by email at viad.info {at} zhdk {dot} ch.

05 Lauflicht

10. November 2011

In dieser Übung erstellten wir ein Lauflicht welches von der Einen zu Anderen Seite laufen sollte.

#define LED_PIN_1 2
#define LED_PIN_2 3
#define LED_PIN_3 4
#define LED_PIN_4 5
#define LED_PIN_5 6
#define LED_PIN_6 7
#define LED_PIN_7 8
#define LED_PIN_8 9
#define LED_PIN_9 10
#define LED_PIN_10 11

int timer = 0;
int durchlauf = 0;

void setup()
{
pinMode(LED_PIN_1, OUTPUT);
pinMode(LED_PIN_2, OUTPUT);
pinMode(LED_PIN_3, OUTPUT);
pinMode(LED_PIN_4, OUTPUT);
pinMode(LED_PIN_5, OUTPUT);
pinMode(LED_PIN_6, OUTPUT);
pinMode(LED_PIN_7, OUTPUT);
pinMode(LED_PIN_8, OUTPUT);
pinMode(LED_PIN_9, OUTPUT);
pinMode(LED_PIN_10, OUTPUT);

Serial.begin(9600);
}

void loop()
{

for(timer; timer < 1; timer++)
{

Serial.println(timer);
digitalWrite(LED_PIN_1, HIGH);
delay(50);
digitalWrite(LED_PIN_1, LOW);

digitalWrite(LED_PIN_2, HIGH);
delay(50);
digitalWrite(LED_PIN_2, LOW);

digitalWrite(LED_PIN_3, HIGH);
delay(50);
digitalWrite(LED_PIN_3, LOW);

digitalWrite(LED_PIN_4, HIGH);
delay(50);
digitalWrite(LED_PIN_4, LOW);

digitalWrite(LED_PIN_5, HIGH);
delay(50);
digitalWrite(LED_PIN_5, LOW);

digitalWrite(LED_PIN_6, HIGH);
delay(50);
digitalWrite(LED_PIN_6, LOW);

digitalWrite(LED_PIN_7, HIGH);
delay(50);
digitalWrite(LED_PIN_7, LOW);

digitalWrite(LED_PIN_8, HIGH);
delay(50);
digitalWrite(LED_PIN_8, LOW);

digitalWrite(LED_PIN_9, HIGH);
delay(50);
digitalWrite(LED_PIN_9, LOW);

digitalWrite(LED_PIN_10, HIGH);
delay(50);
digitalWrite(LED_PIN_10, LOW);

}

for (timer; timer >= 1; timer--)
{
Serial.println(timer);
delay(100);
digitalWrite(LED_PIN_9, HIGH);
delay(100);
digitalWrite(LED_PIN_9, LOW);
delay(100);
digitalWrite(LED_PIN_8, HIGH);
delay(100);
digitalWrite(LED_PIN_8, LOW);
delay(100);
digitalWrite(LED_PIN_7, HIGH);
delay(100);
digitalWrite(LED_PIN_7, LOW);
delay(100);
digitalWrite(LED_PIN_6, HIGH);
delay(100);
digitalWrite(LED_PIN_6, LOW);
delay(100);
digitalWrite(LED_PIN_5, HIGH);
delay(100);
digitalWrite(LED_PIN_5, LOW);
delay(100);
digitalWrite(LED_PIN_4, HIGH);
delay(100);
digitalWrite(LED_PIN_4, LOW);
delay(100);
digitalWrite(LED_PIN_3, HIGH);
delay(100);
digitalWrite(LED_PIN_3, LOW);
delay(100);
digitalWrite(LED_PIN_2, HIGH);
delay(100);
digitalWrite(LED_PIN_2, LOW);
delay(100);
}

Serial.println(timer);
}