User Tools

Site Tools


projets:fuz:ac_giant_led_matrix

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
projets:fuz:ac_giant_led_matrix [2019-02-22 20:22] barziprojets:fuz:ac_giant_led_matrix [2019-02-22 23:58] jeanneret
Line 14: Line 14:
  
 ===== Dev ===== ===== Dev =====
 +
 +++++ Code arduino 240V lettres 2 colonnes |
 +<code c>
 +
 +#include <DIO2.h>
 +#define DEBUG false
 +
 +#define COL_NB 2
 +#define LIN_NB 7
 +
 +int pin_col[COL_NB] = {3, 2};
 +int pin_lin[LIN_NB] = {4, 5, 6, 7, 8, 9, 10};
 +
 +int seg[2][7] = { {0, 1, 0, 1, 0, 0, 0},{1, 0, 1, 0, 1, 0, 0} };
 +
 +//AC
 +#define  pinACsense A0
 +int last_AC_detect = LOW;
 +
 +void setup() {
 +  //AC
 +  pinMode2(pinACsense, INPUT);
 +  pinMode2(LED_BUILTIN, OUTPUT);
 +
 +  for (int i = 0; i < COL_NB; i++) {
 +    pinMode2(pin_col[i], OUTPUT);
 +  }
 +
 +  for (int i = 0; i < LIN_NB; i++) {
 +    pinMode2(pin_lin[i], OUTPUT);
 +  }
 +
 +  if (DEBUG) Serial.begin(115200);
 +  if (DEBUG) Serial.println("let's rock!");
 +}
 +
 +
 +int letter[7];
 +
 +void loop() {
 +  //int digitNb = ((long)millis / 1000) % 2;
 +
 +  // COLONNES < 2
 +  for (int j = 0; j < 2; j++) {
 +
 +    // copy current letter
 +    /*
 +    for (int k = 0; k < 7; k++) {
 +      letter[k] = seg[j][k];
 +      if (DEBUG) Serial.print(letter[k]);
 +      if (DEBUG) Serial.print("\t");
 +    }
 +    if (DEBUG) Serial.println("");
 +    */
 +    ////////////////////
 +
 +    // allume une colonne
 +    int b = pin_col[j];
 +    digitalWrite2(b, HIGH);
 +
 +
 +    // LIGNES < 7
 +    for (int i = 0; i < 7; i++) {
 +
 +      int a = pin_lin[i];
 +
 +      //if (letter[i] == 1) {
 +      if (seg[j][i] == 1) {
 +        digitalWrite2(a, HIGH);
 +        if (DEBUG) Serial.print("HIGH");
 +      }
 +      else {
 +        digitalWrite2(a, LOW);
 +        if (DEBUG) Serial.print("LOW");
 +      }
 +      if (DEBUG) Serial.println("");
 +
 +    } // end lines
 +
 +
 +    // persistence retinienne (env 40ms)
 +    
 +    delayMicroseconds(9000);
 +    
 +    // Wait for AC sync...
 +    int AC_detect = LOW;
 +    while ( AC_detect !=  HIGH) {
 +      AC_detect = digitalRead2(pinACsense);
 +    }
 +
 +
 +    // cols down
 +    digitalWrite2(b, LOW);
 +     
 +    // lines down
 +    for (int t = 0; t < 7; t++) {
 +      int z = pin_lin[t];
 +      digitalWrite2(z, LOW);
 +    }
 +    
 +  } // end cols
 +
 +}
 +</code>
 +++++
  
 ++++ Code arduino 240V led matrix test simple  ++++ Code arduino 240V led matrix test simple 
projets/fuz/ac_giant_led_matrix.txt · Last modified: 2023-02-02 22:06 by 127.0.0.1