From c65ef38b9c49569ed69aa4a808c1a79614b66d5f Mon Sep 17 00:00:00 2001 From: cederbach Date: Sat, 26 Oct 2024 18:02:03 +0200 Subject: [PATCH] =?UTF-8?q?Simulationsprogramm=20f=C3=BCr=20ein=20DCF77=20?= =?UTF-8?q?Signal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Das Programm dient zum Test, ob ein DCF77 Signal von einer Software erkannt wird. --- DCF77_Simulator.ino | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 DCF77_Simulator.ino diff --git a/DCF77_Simulator.ino b/DCF77_Simulator.ino new file mode 100644 index 0000000..99c1677 --- /dev/null +++ b/DCF77_Simulator.ino @@ -0,0 +1,64 @@ +/* + Das Programm gibt eine Bitfolge aus, die ein DCF 77 Signal simuliert + Es sind genau 59 Bit, die nach einer kurzen Pause wiederholt werden + Die simulierte Zeit ist 17.03 Uhr + 0-00011110001110-001001-11000000-1110100-011000-111-00001-001001000 +*/ + + +#define outPin 16 // D0 +byte selectBit; + +int timeBit[59] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 2}; + +void setup() { + pinMode(outPin, OUTPUT); + digitalWrite(outPin, LOW); +} + +void loop() { + for (int i = 0; i <= 58; i++) { + int a = timeBit[i]; + if (a == 0) { + selectBit = 0; + } + if (a == 1) { + selectBit = 1; + } + if (a == 2) { + selectBit = 2; + } + + switch (selectBit) { + case 0: + digitalWrite(outPin, HIGH); + delay(100); + digitalWrite(outPin, LOW); + delay(900); + break; + + case 1: + digitalWrite(outPin, HIGH); + delay(200); + digitalWrite(outPin, LOW); + delay(800); + break; + + case 2: + digitalWrite(outPin, HIGH); + delay(100); + digitalWrite(outPin, LOW); + delay(1900); + break; + + case 3: + digitalWrite(outPin, HIGH); + delay(200); + digitalWrite(outPin, LOW); + delay(1800); + break; + } + + } + +}