Recupération d'un afficheur LED à décalage : Différence entre versions

De HATLAB
Ligne 111 : Ligne 111 :
 
|Step_Title=Le Code
 
|Step_Title=Le Code
 
|Step_Content=<code>
 
|Step_Content=<code>
<pre style='color:#000000;background:#ffffff;'><span style='color:#004a43; '>#</span><span style='color:#004a43; '>define</span><span style='color:#004a43; '> data 2</span>
+
#define data 2
<span style='color:#004a43; '>#</span><span style='color:#004a43; '>define</span><span style='color:#004a43; '> clock 3    </span><span style='color:#696969; '>//D PWM</span>
+
#define clock 3    //D PWM
  
<span style='color:#696969; '>/*</span>
+
/*
<span style='color:#696969; '>&#xa0;* CHILLER DISP Rev 0.0</span>
+
* CHILLER DISP Rev 0.0
<span style='color:#696969; '>&#xa0;&#xa0;LED Display:    ___</span>
+
  LED Display:    ___
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;6! 1 !2</span>
+
        6! 1 !2
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;!  !</span>
+
          !  !
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;---</span>
+
          ---
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;! 7 !</span>
+
          ! 7 !
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;5!  !3</span>
+
        5!  !3
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;---</span>
+
          ---
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;8°  4        bits: 12345678</span>
+
      8°  4        bits: 12345678
<span style='color:#696969; '>&#xa0;&#xa0;Connectors:</span>
+
  Connectors:
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;CON3</span>
+
        CON3
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;GND GND GND  </span>
+
    GND GND GND   
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;SW2            DATA</span>
+
SW2            DATA
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;CON2 SW1              GND  CON1 </span>
+
  CON2 SW1              GND  CON1  
<span style='color:#696969; '>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;CLK              +5V</span>
+
CLK              +5V
<span style='color:#696969; '></span>
 
<span style='color:#696969; '>&#xa0;*/</span>
 
  
<span style='color:#800000; font-weight:bold; '>unsigned</span> <span style='color:#800000; font-weight:bold; '>int</span> cnt <span style='color:#808030; '>=</span> <span style='color:#008c00; '>0</span><span style='color:#800080; '>;</span>
+
*/
byte symbol<span style='color:#808030; '>,</span> symbols<span style='color:#808030; '>[</span><span style='color:#808030; '>]</span> <span style='color:#808030; '>=</span> <span style='color:#800080; '>{</span>
 
B11111100<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 0</span>
 
B01100000<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 1</span>
 
B11011010<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 2</span>
 
B11110010<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 3</span>
 
B01100110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 4</span>
 
B10110110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 5</span>
 
B10111110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 6</span>
 
B11100000<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 7</span>
 
B11111110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 8</span>
 
B11110110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 9</span>
 
B11101110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// A</span>
 
B00111110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// B</span>
 
B10011100<span style='color:#808030; '>,</span> <span style='color:#696969; '>// C</span>
 
B01111010<span style='color:#808030; '>,</span> <span style='color:#696969; '>// D</span>
 
B10011110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// E</span>
 
B10001110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// F</span>
 
B00011100<span style='color:#808030; '>,</span> <span style='color:#696969; '>// L</span>
 
B00101010<span style='color:#808030; '>,</span> <span style='color:#696969; '>// M</span>
 
B11000110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// °</span>
 
B01001010  <span style='color:#696969; '>// %</span>
 
<span style='color:#800080; '>}</span><span style='color:#800080; '>;</span>
 
  
 +
unsigned int cnt = 0;
 +
byte symbol, symbols[] = {
 +
B11111100, // 0
 +
B01100000, // 1
 +
B11011010, // 2
 +
B11110010, // 3
 +
B01100110, // 4
 +
B10110110, // 5
 +
B10111110, // 6
 +
B11100000, // 7
 +
B11111110, // 8
 +
B11110110, // 9
 +
B11101110, // A
 +
B00111110, // B
 +
B10011100, // C
 +
B01111010, // D
 +
B10011110, // E
 +
B10001110, // F
 +
B00011100, // L
 +
B00101010, // M
 +
B11000110, // °
 +
B01001010  // %
 +
};
  
 +
void setup()
 +
{
 +
  pinMode(clock, OUTPUT); // make the clock pin an output
 +
  pinMode(data , OUTPUT); // make the data pin an output
 +
}
  
 +
void loop() {
 +
  // put your main code here, to run repeatedly:
  
  
<span style='color:#800000; font-weight:bold; '>void</span> setup<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>
+
  shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register
<span style='color:#800080; '>{</span>
+
  shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register
  pinMode<span style='color:#808030; '>(</span><span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> OUTPUT<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// make the clock pin an output</span>
+
  shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register
  pinMode<span style='color:#808030; '>(</span>data <span style='color:#808030; '>,</span> OUTPUT<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// make the data pin an output</span>
+
  shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register
<span style='color:#800080; '>}</span>
+
  delay(1000);
 +
  shiftOut(data, clock, LSBFIRST, B00000001); // send this binary value to the shift register
 +
  shiftOut(data, clock, LSBFIRST, B00000010); // send this binary value to the shift register
 +
  shiftOut(data, clock, LSBFIRST, B00000100); // send this binary value to the shift register
 +
  shiftOut(data, clock, LSBFIRST, B00001000); // send this binary value to the shift register
 +
  delay(1000);
 +
  shiftOut(data, clock, LSBFIRST, B00010000); // send this binary value to the shift register
 +
  shiftOut(data, clock, LSBFIRST, B00100000); // send this binary value to the shift register
 +
  shiftOut(data, clock, LSBFIRST, B01000000); // send this binary value to the shift register
 +
  shiftOut(data, clock, LSBFIRST, B10000000); // send this binary value to the shift register
 +
  delay(1000);
 +
  shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register
 +
  shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register
 +
  shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register
 +
  shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register
  
<span style='color:#800000; font-weight:bold; '>void</span> loop<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span> <span style='color:#800080; '>{</span>
+
  delay(1000);
  <span style='color:#696969; '>// put your main code here, to run repeatedly:</span>
 
  
 +
  shiftOut(data, clock, LSBFIRST, B10101010); // send this binary value to the shift register
 +
  delay(1000);
  
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
+
for(int i = 0; i < 4; ++i) //for 0 - 7 do
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
+
  {
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
+
    shiftOut(data, clock, LSBFIRST, B01010101); // bit shift a logic high (1) value by i
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
+
    delay(500); // delay 100ms or you would not be able to see it
  delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>1000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> 
+
  }
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000001<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
+
  delay(1000);
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000010<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000100<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00001000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>1000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> 
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00010000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00100000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B01000000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B10000000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>1000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> 
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B00000000<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
 
  
  delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>1000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> 
+
for(int i = 0; i < 4; ++i) //for 0 - 7 do
 +
  {
 +
    shiftOut(data, clock, LSBFIRST, B10101010); // bit shift a logic high (1) value by i
 +
    delay(500); // delay 100ms or you would not be able to see it
 +
  }
  
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B10101010<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send this binary value to the shift register</span>
+
  delay(1500);
  delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>1000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
 
  
<span style='color:#800000; font-weight:bold; '>for</span><span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>int</span> i <span style='color:#808030; '>=</span> <span style='color:#008c00; '>0</span><span style='color:#800080; '>;</span> i <span style='color:#808030; '>&lt;</span> <span style='color:#008c00; '>4</span><span style='color:#800080; '>;</span> <span style='color:#808030; '>+</span><span style='color:#808030; '>+</span>i<span style='color:#808030; '>)</span> <span style='color:#696969; '>//for 0 - 7 do</span>
+
for(int i = 0; i < 12; ++i) //for 0 - 7 do
  <span style='color:#800080; '>{</span>
+
  {
    shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B01010101<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// bit shift a logic high (1) value by i</span>
+
    shiftOut(data, clock, MSBFIRST, 1 << i ); // bit shift a logic high (1) value by i
    delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>500</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// delay 100ms or you would not be able to see it</span>
+
    delay(300); // delay 100ms or you would not be able to see it
  <span style='color:#800080; '>}</span>
+
  }
  delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>1000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
 
  
<span style='color:#800000; font-weight:bold; '>for</span><span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>int</span> i <span style='color:#808030; '>=</span> <span style='color:#008c00; '>0</span><span style='color:#800080; '>;</span> i <span style='color:#808030; '>&lt;</span> <span style='color:#008c00; '>4</span><span style='color:#800080; '>;</span> <span style='color:#808030; '>+</span><span style='color:#808030; '>+</span>i<span style='color:#808030; '>)</span> <span style='color:#696969; '>//for 0 - 7 do</span>
+
  delay(1000);
  <span style='color:#800080; '>{</span>
 
    shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> B10101010<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// bit shift a logic high (1) value by i</span>
 
    delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>500</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// delay 100ms or you would not be able to see it</span>
 
  <span style='color:#800080; '>}</span>
 
  
  delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>1500</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
 
  
<span style='color:#800000; font-weight:bold; '>for</span><span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>int</span> i <span style='color:#808030; '>=</span> <span style='color:#008c00; '>0</span><span style='color:#800080; '>;</span> i <span style='color:#808030; '>&lt;</span> <span style='color:#008c00; '>12</span><span style='color:#800080; '>;</span> <span style='color:#808030; '>+</span><span style='color:#808030; '>+</span>i<span style='color:#808030; '>)</span> <span style='color:#696969; '>//for 0 - 7 do</span>
+
for(int i = 0; i < 19; ++i) // counter 0 to F puis -> %
  <span style='color:#800080; '>{</span>
+
  {
    shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> MSBFIRST<span style='color:#808030; '>,</span> <span style='color:#008c00; '>1</span> <span style='color:#808030; '>&lt;</span><span style='color:#808030; '>&lt;</span> i <span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// bit shift a logic high (1) value by i</span>
+
  cnt=i;
    delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>300</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// delay 100ms or you would not be able to see it</span>
+
  symbol = symbols[cnt++%sizeof(symbols)] ;
  <span style='color:#800080; '>}</span>
+
  shiftOut(data, clock, LSBFIRST, symbol); // send data
 +
  delay(500); // pause for 1/2 second
 +
  }
  
  delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>1000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
+
  cnt = 17;  //M
 +
  symbol = symbols[cnt++%sizeof(symbols)] ;
 +
  shiftOut(data, clock, LSBFIRST, symbol); // send data
 +
  cnt = 14;  //E
 +
  symbol = symbols[cnt++%sizeof(symbols)] ;
 +
  shiftOut(data, clock, LSBFIRST, symbol); // send data
 +
  cnt = 16; //L
 +
  symbol = symbols[cnt++%sizeof(symbols)] ;
 +
  shiftOut(data, clock, LSBFIRST, symbol); // send data
 +
  cnt = 12; //C
 +
  symbol = symbols[cnt++%sizeof(symbols)] ;
 +
  shiftOut(data, clock, LSBFIRST, symbol); // send data
 +
  delay(4000);
  
 
+
}
<span style='color:#800000; font-weight:bold; '>for</span><span style='color:#808030; '>(</span><span style='color:#800000; font-weight:bold; '>int</span> i <span style='color:#808030; '>=</span> <span style='color:#008c00; '>0</span><span style='color:#800080; '>;</span> i <span style='color:#808030; '>&lt;</span> <span style='color:#008c00; '>19</span><span style='color:#800080; '>;</span> <span style='color:#808030; '>+</span><span style='color:#808030; '>+</span>i<span style='color:#808030; '>)</span> <span style='color:#696969; '>// counter 0 to F puis -> %</span>
 
  <span style='color:#800080; '>{</span>
 
  cnt<span style='color:#808030; '>=</span>i<span style='color:#800080; '>;</span>
 
  symbol <span style='color:#808030; '>=</span> symbols<span style='color:#808030; '>[</span>cnt<span style='color:#808030; '>+</span><span style='color:#808030; '>+</span><span style='color:#808030; '>%</span><span style='color:#800000; font-weight:bold; '>sizeof</span><span style='color:#808030; '>(</span>symbols<span style='color:#808030; '>)</span><span style='color:#808030; '>]</span> <span style='color:#808030; '></span> <span style='color:#808030; '>(</span>cnt<span style='color:#808030; '>%</span><span style='color:#008c00; '>2</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
 
  shiftOut<span style='color:#808030; '>(</span>data<span style='color:#808030; '>,</span> <span style='color:#603000; '>clock</span><span style='color:#808030; '>,</span> LSBFIRST<span style='color:#808030; '>,</span> symbol<span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// send data</span>
 
  delay<span style='color:#808030; '>(</span><span style='color:#008c00; '>500</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>// pause for 1/2 second</span>
 
  <span style='color:#800080; '>}</span>
 
 
 
 
 
<span style='color:#800080; '>}</span>
 
</pre>
 
 
</code>
 
</code>
 
}}
 
}}
 
{{Notes}}
 
{{Notes}}
 
{{Tuto Status}}
 
{{Tuto Status}}

Version du 29 janvier 2019 à 21:58