Ver código fonte

new dim LEDs for address to program

Klaas, Wilfried 5 anos atrás
pai
commit
197b5a5141
2 arquivos alterados com 34 adições e 5 exclusões
  1. 4 0
      SPS/SPS.ino
  2. 30 5
      SPS/prgmode.ino

+ 4 - 0
SPS/SPS.ino

@@ -1,5 +1,9 @@
 /*
   SPS System mit dem Arduino.
+  Version 0.11
+  07.01.2018
+  - programming: 1/2 duty cycle for 0 values in address display
+
   Version 0.10
   7.12.2018
   - new define for serial programming

+ 30 - 5
SPS/prgmode.ino

@@ -32,14 +32,12 @@ void programMode() {
       dbgOut("Adr:");
       dbgOutLn(addr);
       // LoNibble Adresse anzeigen
-      doPort(addr);
-      delay(SHOW_DELAY);
+      doDimPort(addr);
 
       blinkD2();
       // HiNibble Adresse anzeigen
       data = (addr & 0xf0) >> 4;                                  //Adresse anzeigen
-      doPort(data);
-      delay(SHOW_DELAY);
+      doDimPort(data);
 
       byte Eebyte = EEPROM.read(addr);
       data = Eebyte & 15;
@@ -76,7 +74,7 @@ void programMode() {
       }
       while (digitalRead(SW_PRG) == 1); // S2 = 1
       delay(DEBOUNCE);
-      
+
       byte newValue = (com << 4) + data;
       if (newValue != Eebyte) {
         EEPROM.write(addr, newValue); //           Writeeeprom Eebyte , Addr
@@ -128,3 +126,30 @@ void blinkNull() {
   doPort(0x00);
   delay(BLINK_DELAY);
 }
+
+void doDimPort(byte data) {
+  long value = millis() + SHOW_DELAY;
+  do {
+    // on part
+    digitalWrite(Dout_0, 1);
+    digitalWrite(Dout_1, 1);
+    digitalWrite(Dout_2, 1);
+    digitalWrite(Dout_3, 1);
+    delay(5);
+
+    // off part
+    if ((data & 0x01) == 0) {
+      digitalWrite(Dout_0, 0);
+    }
+    if ((data & 0x02) == 0) {
+      digitalWrite(Dout_1, 0);
+    }
+    if ((data & 0x04) == 0) {
+      digitalWrite(Dout_2, 0);
+    }
+    if ((data & 0x08) == 0) {
+      digitalWrite(Dout_3, 0);
+    }
+    delay(5);
+  } while (value < millis());
+}