|
|
Ligne 110 : |
Ligne 110 : |
| {{Tuto Step | | {{Tuto Step |
| |Step_Title=Le Code | | |Step_Title=Le Code |
− | |Step_Content=[[<pre style='color:#000000;background:#ffffff;'><span style='color:#004a43; '>#</span><span style='color:#004a43; '>define</span><span style='color:#004a43; '> data 2</span> | + | |Step_Content=#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 |
− | | + | void setup() |
− | <span style='color:#696969; '>/*</span>
| + | { |
− | <span style='color:#696969; '> * CHILLER DISP Rev 0.0</span>
| + | pinMode(clock, OUTPUT); // make the clock pin an output |
− | <span style='color:#696969; '>  LED Display: ___</span>
| + | pinMode(data , OUTPUT); // make the data pin an output |
− | <span style='color:#696969; '>                 6| 1 |2</span>
| + | } |
− | <span style='color:#696969; '>                  | |</span>
| + | void loop() { |
− | <span style='color:#696969; '>                   ---</span>
| + | // put your main code here, to run repeatedly: |
− | <span style='color:#696969; '>                  | 7 |</span>
| + | shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register |
− | <span style='color:#696969; '>                 5| |3</span>
| + | shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register |
− | <span style='color:#696969; '>                   ---</span>
| + | shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register |
− | <span style='color:#696969; '>               8° 4 bits: 12345678</span>
| + | shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register |
− | <span style='color:#696969; '>  Connectors:</span>
| + | delay(1000); |
− | <span style='color:#696969; '>                CON3</span>
| + | shiftOut(data, clock, LSBFIRST, B00000001); // send this binary value to the shift register |
− | <span style='color:#696969; '>            GND GND GND </span>
| + | shiftOut(data, clock, LSBFIRST, B00000010); // send this binary value to the shift register |
− | <span style='color:#696969; '>        SW2 DATA</span>
| + | shiftOut(data, clock, LSBFIRST, B00000100); // send this binary value to the shift register |
− | <span style='color:#696969; '>   CON2 SW1 GND CON1 </span>
| + | shiftOut(data, clock, LSBFIRST, B00001000); // send this binary value to the shift register |
− | <span style='color:#696969; '>        CLK +5V</span>
| + | delay(1000); |
− | <span style='color:#696969; '></span>
| + | shiftOut(data, clock, LSBFIRST, B00010000); // send this binary value to the shift register |
− | <span style='color:#696969; '> */</span>
| + | 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 |
− | <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>
| + | shiftOut(data, clock, LSBFIRST, B10000000); // send this binary value to the shift register |
− | 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>
| + | delay(1000); |
− | B11111100<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 0</span>
| + | shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register |
− | B01100000<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 1</span>
| + | shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register |
− | B11011010<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 2</span>
| + | shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register |
− | B11110010<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 3</span>
| + | shiftOut(data, clock, LSBFIRST, B00000000); // send this binary value to the shift register |
− | B01100110<span style='color:#808030; '>,</span> <span style='color:#696969; '>// 4</span>
| + | delay(1000); |
− | 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>
| |
− | | |
− | | |
− | | |
− | | |
− | | |
− | <span style='color:#800000; font-weight:bold; '>void</span> setup<span style='color:#808030; '>(</span><span style='color:#808030; '>)</span>
| |
− | <span style='color:#800080; '>{</span>
| |
− | 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> | |
− | 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> | |
− | <span style='color:#800080; '>}</span> | |
− | | |
− | <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>
| |
− | <span style='color:#696969; '>// put your main code here, to run repeatedly:</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> | |
− | 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> | |
− | 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>
| |
− | | |
− | 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<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; '><</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> | |
− | <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>
| |
− | 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; '>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; '><</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>
| |
− | <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; '><</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>
| |
− | <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; '><</span><span style='color:#808030; '><</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>
| |
− | 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>
| |
− | <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; '><</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>
| |
− | | |
− | cnt <span style='color:#808030; '>=</span> <span style='color:#008c00; '>17</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>//M</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>
| |
− | cnt <span style='color:#808030; '>=</span> <span style='color:#008c00; '>14</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>//E</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>
| |
− | cnt <span style='color:#808030; '>=</span> <span style='color:#008c00; '>16</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>//L</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>
| |
− | cnt <span style='color:#808030; '>=</span> <span style='color:#008c00; '>12</span><span style='color:#800080; '>;</span> <span style='color:#696969; '>//C</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; '>4000</span><span style='color:#808030; '>)</span><span style='color:#800080; '>;</span>
| |
− | | |
− | <span style='color:#800080; '>}</span>
| |
− | </pre>
| |
− | ]]
| |
| }} | | }} |
| {{Notes}} | | {{Notes}} |
| {{Tuto Status}} | | {{Tuto Status}} |