From 2e33f534e0fe663c6c604a2695fd0a5dedb67b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Fri, 15 Apr 2016 09:52:02 +0200 Subject: [PATCH] Create Multiplexer.ino --- .../Dataelektronikk/Examples/Multiplexer.ino | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 School/vg1/Dataelektronikk/Examples/Multiplexer.ino diff --git a/School/vg1/Dataelektronikk/Examples/Multiplexer.ino b/School/vg1/Dataelektronikk/Examples/Multiplexer.ino new file mode 100644 index 0000000..bbe1629 --- /dev/null +++ b/School/vg1/Dataelektronikk/Examples/Multiplexer.ino @@ -0,0 +1,26 @@ +// I already told you man, two LED's at the same time +// Showed a classmate how to multiplex to blink two leds at once + +void setup() { + // initialize digital pin 13 as an output. + pinMode(13, OUTPUT); + pinMode(12, OUTPUT); +} + +int Ontime = 1000; +int loopint = Ontime/3; // Divided by 3 because we wait 3 times +void loop() +{ + for (int i = 0; i < loopint; i++) + { + digitalWrite(13, HIGH); + delay(loopint/100); + digitalWrite(13, LOW); + digitalWrite(12/40, HIGH); + delay (loopint/100); + digitalWrite(12, LOW); + delay (loopint/100); + } + //Off time + delay (1000); + }