Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 PwmOut fade(p22); // voor faden van leds, not used. 00003 DigitalOut latch(p19); 00004 DigitalOut data(p20); 00005 DigitalOut clk(p18); 00006 DigitalOut s1(p17); 00007 DigitalOut s2(p16); 00008 DigitalOut s3(p15); 00009 DigitalOut s4(p14); 00010 DigitalOut s5(p13); 00011 00012 /* 00013 Bit # Meaning 00014 7 Latchable. A 1 here makes the byte latachable, otherwise the byte is considered void and wont latch into the LED. 00015 6 Double speed fading. See the S pin description. If set the LED will fade at double speed. Once on S going high and agan when S goes low. 00016 5 Blue 1 00017 4 Blue 0 00018 3 Red 1 00019 2 Red 0 00020 1 Green 1 00021 0 Green 0 00022 */ 00023 00024 /*Timing specifics: 00025 LED PWM frequency is 500Hz. 00026 Clock ON pulse must be > 300nSec. 00027 Latch should be > 1uSec. 00028 There is a 100nSec delay between latch into each LED and latch OUT of each LED. 00029 After setting the datapin, you must wait at least 250nSec for each LED in your strip BEFORE taking clock high. 100 LEDS = 100 x 250nSec delay between sending last bit of data and taking latch high 00030 */ 00031 00032 /* Color values: 00033 Blue : 0x81 00034 Red : 0x84 00035 Green: 0x94 00036 Pink : 0x8D 00037 White: 0x95 00038 00039 Method of controlling. 00040 00041 First activate line 1 to 5 using s1 to s5. s1=0 -> line is active s1=1 -> line is deactivated. 00042 one LED is one RGB pixel. Send a value using sendbyte(), then use send_position() to activate the led on the chosen position. 00043 00044 Want to send a letter? 00045 e.g. A(0,0), this means letter A to position 0 and color RED, RED is starting color. What you type behind the first brace is the position, to change the color type the difference with color value and red. This will be added in the function. 00046 Starting position of all letters is the third led on the strip, this is done because of building purposes. 00047 */ 00048 00049 DigitalOut myled(LED1); 00050 00051 00052 void sendByte(unsigned char it) // decoderen van een byte naar serieel uitsturen 00053 { 00054 char x; 00055 clk=0; 00056 00057 for(x=0; x<8; x++) 00058 { 00059 if(128 & it) data=1; // 128 om te kijken of de data bedoelt is om te latchen, zo niet wordt er niks uitgestuurd 00060 else data=0; 00061 it = it<<1; 00062 wait_us(0.1); // 250x het aantal leds, dan in ns voor te zorgen dat het signaal wel het einde van de strip bereikt. 00063 clk=1; 00064 wait_us(0.3); // vereiste pulsbreedte van de clk. 00065 clk=0; 00066 } 00067 00068 } 00069 00070 void clear() 00071 { 00072 int i; 00073 for(i=0 ; i < 80 ; i++)// i< het aantal leds op de strip 00074 { 00075 sendByte(0); 00076 } 00077 } 00078 00079 void latchen(){ 00080 00081 latch=1; 00082 wait_us(0.001); 00083 latch=0; 00084 } 00085 00086 void send_position(int x){ 00087 int i; 00088 for(i=0 ; i < x ; i++) // doorschuiven naar positie x 00089 { 00090 sendByte(0); 00091 } 00092 latchen(); // die plaats aan zetten. 00093 clear(); 00094 00095 00096 00097 } 00098 00099 void erase(){ 00100 int x = 85; 00101 00102 s1=0; 00103 s2=0; 00104 s3=0; 00105 00106 s4=0; 00107 s5=0; 00108 00109 for(int i=0 ; i < x ; i++) // alle leds uitzetten 00110 { 00111 sendByte(128); 00112 00113 } 00114 latchen(); 00115 s1=1; 00116 s2=1; 00117 s3=1; 00118 s4=1; 00119 s5=1; 00120 00121 } 00122 00123 void move(int x) 00124 { 00125 s1=0; 00126 s2=0; 00127 s3=0; 00128 00129 s4=0; 00130 s5=0; 00131 00132 for(int i=0 ; i < x ; i++) // x aantal leds uitzetten. 00133 { 00134 sendByte(128); 00135 00136 } 00137 latchen(); 00138 00139 00140 s1=1; 00141 s2=1; 00142 s3=1; 00143 s4=1; 00144 s5=1; 00145 00146 } 00147 00148 void punt(int pos, int kleur) 00149 { 00150 00151 s5=0; 00152 sendByte(0x84+kleur); 00153 send_position(4+pos); 00154 00155 s5=1; 00156 00157 } 00158 00159 void Z(int pos, int kleur) 00160 { 00161 00162 s1=0; 00163 sendByte(0x84+kleur); 00164 send_position(2+pos); 00165 sendByte(0x84+kleur); 00166 send_position(3+pos); 00167 sendByte(0x84+kleur); 00168 send_position(4+pos); 00169 sendByte(0x84+kleur); 00170 send_position(5+pos); 00171 sendByte(0x84+kleur); 00172 send_position(6+pos); 00173 s1=1; 00174 s2=0; 00175 sendByte(0x84+kleur); 00176 send_position(5+pos); 00177 00178 s2=1; 00179 s3=0; 00180 sendByte(0x84+kleur); 00181 send_position(4+pos); 00182 s3=1; 00183 s4=0; 00184 sendByte(0x84+kleur); 00185 send_position(3+pos); 00186 s4=1; 00187 s5=0; 00188 sendByte(0x84+kleur); 00189 send_position(2+pos); 00190 sendByte(0x84+kleur); 00191 send_position(3+pos); 00192 sendByte(0x84+kleur); 00193 send_position(4+pos); 00194 sendByte(0x84+kleur); 00195 send_position(5+pos); 00196 sendByte(0x84+kleur); 00197 send_position(6+pos); 00198 s5=1; 00199 00200 /// ***** Eind Z ***/ 00201 00202 00203 00204 } 00205 00206 void Y(int pos, int kleur) 00207 { 00208 00209 s1=0; 00210 sendByte(0x84+kleur); 00211 send_position(2+pos); 00212 sendByte(0x84+kleur); 00213 send_position(6+pos); 00214 s1=1; 00215 s2=0; 00216 sendByte(0x84+kleur); 00217 send_position(3+pos); 00218 sendByte(0x84+kleur); 00219 send_position(5+pos); 00220 s2=1; 00221 s3=0; 00222 sendByte(0x84+kleur); 00223 send_position(4+pos); 00224 s3=1; 00225 s4=0; 00226 sendByte(0x84+kleur); 00227 send_position(4+pos); 00228 s4=1; 00229 s5=0; 00230 sendByte(0x84+kleur); 00231 send_position(4+pos); 00232 s5=1; 00233 00234 ///*** Eind Y **** /// 00235 00236 00237 } 00238 00239 void X(int pos, int kleur) 00240 { 00241 00242 s1=0; 00243 sendByte(0x84+kleur); 00244 send_position(2+pos); 00245 sendByte(0x84+kleur); 00246 send_position(6+pos); 00247 s1=1; 00248 s2=0; 00249 sendByte(0x84+kleur); 00250 send_position(3+pos); 00251 sendByte(0x84+kleur); 00252 send_position(5+pos); 00253 s2=1; 00254 s3=0; 00255 sendByte(0x84+kleur); 00256 send_position(4+pos); 00257 s3=1; 00258 s4=0; 00259 sendByte(0x84+kleur); 00260 send_position(3+pos); 00261 sendByte(0x84+kleur); 00262 send_position(5+pos); 00263 s4=1; 00264 s5=0; 00265 sendByte(0x84+kleur); 00266 send_position(2+pos); 00267 sendByte(0x84+kleur); 00268 send_position(6+pos); 00269 s5=1; 00270 00271 ///*** Eind X **** /// 00272 00273 00274 } 00275 00276 void W(int pos, int kleur) 00277 { 00278 00279 s1=0; 00280 sendByte(0x84+kleur); 00281 send_position(2+pos); 00282 sendByte(0x84+kleur); 00283 send_position(6+pos); 00284 s1=1; 00285 s2=0; 00286 sendByte(0x84+kleur); 00287 send_position(2+pos); 00288 sendByte(0x84+kleur); 00289 send_position(6+pos); 00290 s2=1; 00291 s3=0; 00292 sendByte(0x84+kleur); 00293 send_position(2+pos); 00294 sendByte(0x84+kleur); 00295 send_position(6+pos); 00296 s3=1; 00297 s4=0; 00298 sendByte(0x84+kleur); 00299 send_position(2+pos); 00300 sendByte(0x84+kleur); 00301 send_position(4+pos); 00302 sendByte(0x84+kleur); 00303 send_position(6+pos); 00304 s4=1; 00305 s5=0; 00306 sendByte(0x84+kleur); 00307 send_position(3+pos); 00308 sendByte(0x84+kleur); 00309 send_position(5+pos); 00310 s5=1; 00311 00312 /// ***** Eind W ***/ 00313 00314 00315 } 00316 00317 void V(int pos, int kleur) 00318 { 00319 00320 s1=0; 00321 sendByte(0x84+kleur); 00322 send_position(2+pos); 00323 sendByte(0x84+kleur); 00324 send_position(6+pos); 00325 s1=1; 00326 s2=0; 00327 sendByte(0x84+kleur); 00328 send_position(2+pos); 00329 sendByte(0x84+kleur); 00330 send_position(6+pos); 00331 s2=1; 00332 s3=0; 00333 sendByte(0x84+kleur); 00334 send_position(2+pos); 00335 sendByte(0x84+kleur); 00336 send_position(6+pos); 00337 s3=1; 00338 s4=0; 00339 sendByte(0x84+kleur); 00340 send_position(3+pos); 00341 sendByte(0x84+kleur); 00342 send_position(5+pos); 00343 s4=1; 00344 s5=0; 00345 sendByte(0x84+kleur); 00346 send_position(4+pos); 00347 s5=1; 00348 00349 /// ***** Eind V ***/ 00350 00351 00352 } 00353 void U(int pos, int kleur) 00354 { 00355 00356 s1=0; 00357 sendByte(0x84+kleur); 00358 send_position(2+pos); 00359 sendByte(0x84+kleur); 00360 send_position(5+pos); 00361 s1=1; 00362 s2=0; 00363 sendByte(0x84+kleur); 00364 send_position(2+pos); 00365 sendByte(0x84+kleur); 00366 send_position(5+pos); 00367 s2=1; 00368 s3=0; 00369 sendByte(0x84+kleur); 00370 send_position(2+pos); 00371 sendByte(0x84+kleur); 00372 send_position(5+pos); 00373 s3=1; 00374 s4=0; 00375 sendByte(0x84+kleur); 00376 send_position(2+pos); 00377 sendByte(0x84+kleur); 00378 send_position(5+pos); 00379 s4=1; 00380 s5=0; 00381 sendByte(0x84+kleur); 00382 send_position(3+pos); 00383 sendByte(0x84+kleur); 00384 send_position(4+pos); 00385 s5=1; 00386 00387 /// ***** Eind U ***/ 00388 00389 } 00390 00391 void T(int pos, int kleur) 00392 { 00393 s1=0; 00394 sendByte(0x84+kleur); 00395 send_position(2+pos); 00396 sendByte(0x84+kleur); 00397 send_position(3+pos); 00398 sendByte(0x84+kleur); 00399 send_position(4+pos); 00400 sendByte(0x84+kleur); 00401 send_position(5+pos);; 00402 sendByte(0x84+kleur); 00403 send_position(6+pos); 00404 s1=1; 00405 s2=0; 00406 sendByte(0x84+kleur); 00407 send_position(4+pos); 00408 s2=1; 00409 s3=0; 00410 sendByte(0x84+kleur); 00411 send_position(4+pos); 00412 s3=1; 00413 s4=0; 00414 sendByte(0x84+kleur); 00415 send_position(4+pos); 00416 s4=1; 00417 s5=0; 00418 sendByte(0x84+kleur); 00419 send_position(4+pos); 00420 s5=1; 00421 00422 00423 ///** Einde T ***/ 00424 00425 } 00426 00427 00428 void S(int pos, int kleur) 00429 { 00430 00431 s1=0; 00432 sendByte(0x84+kleur); 00433 send_position(3+pos); 00434 sendByte(0x84+kleur); 00435 send_position(4+pos); 00436 sendByte(0x84+kleur); 00437 send_position(5+pos); 00438 s1=1; 00439 s2=0; 00440 sendByte(0x84+kleur); 00441 send_position(2+pos); 00442 s2=1; 00443 s3=0; 00444 sendByte(0x84+kleur); 00445 send_position(3+pos); 00446 sendByte(0x84+kleur); 00447 send_position(4+pos); 00448 s3=1; 00449 s4=0; 00450 sendByte(0x84+kleur); 00451 send_position(5+pos); 00452 s4=1; 00453 s5=0; 00454 sendByte(0x84+kleur); 00455 send_position(2+pos); 00456 sendByte(0x84+kleur); 00457 send_position(3+pos); 00458 sendByte(0x84+kleur); 00459 send_position(4+pos); 00460 s5=1; 00461 00462 /// ***** Eind S ***/ 00463 00464 00465 00466 } 00467 void R(int pos, int kleur) 00468 { 00469 00470 s1=0; 00471 sendByte(0x84+kleur); 00472 send_position(2+pos); 00473 sendByte(0x84+kleur); 00474 send_position(3+pos); 00475 sendByte(0x84+kleur); 00476 send_position(4+pos); 00477 s1=1; 00478 s2=0; 00479 sendByte(0x84+kleur); 00480 send_position(2+pos); 00481 sendByte(0x84+kleur); 00482 send_position(4+pos); 00483 s2=1; 00484 s3=0; 00485 sendByte(0x84+kleur); 00486 send_position(2+pos); 00487 sendByte(0x84+kleur); 00488 send_position(3+pos); 00489 s3=1; 00490 s4=0; 00491 sendByte(0x84+kleur); 00492 send_position(2+pos); 00493 sendByte(0x84+kleur); 00494 send_position(4+pos); 00495 s4=1; 00496 s5=0; 00497 sendByte(0x84+kleur); 00498 send_position(2+pos); 00499 sendByte(0x84+kleur); 00500 send_position(5+pos); 00501 s5=1; 00502 00503 ///*** Eind R **** /// 00504 00505 } 00506 00507 void Q(int pos, int kleur) 00508 { 00509 00510 s1=0; 00511 sendByte(0x84+kleur); 00512 send_position(3+pos); 00513 sendByte(0x84+kleur); 00514 send_position(4+pos); 00515 s1=1; 00516 s2=0; 00517 sendByte(0x84+kleur); 00518 send_position(2+pos); 00519 sendByte(0x84+kleur); 00520 send_position(5+pos); 00521 s2=1; 00522 s3=0; 00523 sendByte(0x84+kleur); 00524 send_position(2+pos); 00525 sendByte(0x84+kleur); 00526 send_position(4+pos); 00527 sendByte(0x84+kleur); 00528 send_position(5+pos); 00529 s3=1; 00530 s4=0; 00531 sendByte(0x84+kleur); 00532 send_position(3+pos); 00533 sendByte(0x84+kleur); 00534 send_position(4+pos); 00535 sendByte(0x84+kleur); 00536 send_position(5+pos); 00537 s4=1; 00538 s5=0; 00539 sendByte(0x84+kleur); 00540 send_position(6+pos); 00541 s5=1; 00542 00543 00544 00545 ///*** Eind Q **** /// 00546 00547 00548 00549 } 00550 00551 void P(int pos, int kleur) 00552 { 00553 00554 s1=0; 00555 sendByte(0x84+kleur); 00556 send_position(2+pos); 00557 sendByte(0x84+kleur); 00558 send_position(3+pos); 00559 sendByte(0x84+kleur); 00560 send_position(4+pos); 00561 s1=1; 00562 s2=0; 00563 sendByte(0x84+kleur); 00564 send_position(2+pos); 00565 sendByte(0x84+kleur); 00566 send_position(4+pos); 00567 s2=1; 00568 s3=0; 00569 sendByte(0x84+kleur); 00570 send_position(2+pos); 00571 sendByte(0x84+kleur); 00572 send_position(3+pos); 00573 sendByte(0x84+kleur); 00574 send_position(4+pos); 00575 s3=1; 00576 s4=0; 00577 sendByte(0x84+kleur); 00578 send_position(2+pos); 00579 s4=1; 00580 s5=0; 00581 sendByte(0x84+kleur); 00582 send_position(2+pos); 00583 s5=1; 00584 00585 ///*** Eind P **** /// 00586 00587 00588 } 00589 00590 void O(int pos, int kleur) 00591 { 00592 s1=0; 00593 sendByte(0x84+kleur); 00594 send_position(3+pos); 00595 sendByte(0x84+kleur); 00596 send_position(4+pos); 00597 s1=1; 00598 s2=0; 00599 sendByte(0x84+kleur); 00600 send_position(2+pos); 00601 sendByte(0x84+kleur); 00602 send_position(5+pos); 00603 s2=1; 00604 s3=0; 00605 sendByte(0x84+kleur); 00606 send_position(2+pos); 00607 sendByte(0x84+kleur); 00608 send_position(5+pos); 00609 s3=1; 00610 s4=0; 00611 sendByte(0x84+kleur); 00612 send_position(2+pos); 00613 sendByte(0x84+kleur); 00614 send_position(5+pos); 00615 s4=1; 00616 s5=0; 00617 sendByte(0x84+kleur); 00618 send_position(3+pos); 00619 sendByte(0x84+kleur); 00620 send_position(4+pos); 00621 s5=1; 00622 00623 /// ***** Eind O ***/ 00624 00625 00626 } 00627 00628 void N(int pos, int kleur) 00629 { 00630 s1=0; 00631 sendByte(0x84+kleur); 00632 send_position(2+pos); 00633 sendByte(0x84+kleur); 00634 send_position(6+pos); 00635 s1=1; 00636 s2=0; 00637 sendByte(0x84+kleur); 00638 send_position(2+pos); 00639 sendByte(0x84+kleur); 00640 send_position(3+pos); 00641 sendByte(0x84+kleur); 00642 send_position(6+pos); 00643 s2=1; 00644 s3=0; 00645 sendByte(0x84+kleur); 00646 send_position(2+pos); 00647 sendByte(0x84+kleur); 00648 send_position(4+pos); 00649 sendByte(0x84+kleur); 00650 send_position(6+pos); 00651 s3=1; 00652 s4=0; 00653 sendByte(0x84+kleur); 00654 send_position(2+pos); 00655 sendByte(0x84+kleur); 00656 send_position(6+pos); 00657 sendByte(0x84+kleur); 00658 send_position(5+pos); 00659 s4=1; 00660 s5=0; 00661 sendByte(0x84+kleur); 00662 send_position(2+pos); 00663 sendByte(0x84+kleur); 00664 send_position(6+pos); 00665 s5=1; 00666 00667 ///*** Eind N**** /// 00668 00669 00670 00671 } 00672 void M(int pos, int kleur) 00673 { 00674 00675 s1=0; 00676 sendByte(0x84+kleur); 00677 send_position(2+pos); 00678 sendByte(0x84+kleur); 00679 send_position(6+pos); 00680 s1=1; 00681 s2=0; 00682 sendByte(0x84+kleur); 00683 send_position(2+pos); 00684 sendByte(0x84+kleur); 00685 send_position(3+pos); 00686 sendByte(0x84+kleur); 00687 send_position(5+pos); 00688 sendByte(0x84+kleur); 00689 send_position(6+pos); 00690 s2=1; 00691 s3=0; 00692 sendByte(0x84+kleur); 00693 send_position(2+pos); 00694 sendByte(0x84+kleur); 00695 send_position(4+pos); 00696 sendByte(0x84+kleur); 00697 send_position(6+pos); 00698 s3=1; 00699 s4=0; 00700 s5=0; 00701 sendByte(0x84+kleur); 00702 send_position(2+pos); 00703 sendByte(0x84+kleur); 00704 send_position(6+pos); 00705 s4=1; 00706 s5=1; 00707 00708 ///*** Eind M**** /// 00709 00710 00711 00712 } 00713 00714 00715 void L(int pos, int kleur) 00716 { 00717 s1=0; 00718 sendByte(0x84+kleur); 00719 send_position(2+pos); 00720 s1=1; 00721 s2=0; 00722 sendByte(0x84+kleur); 00723 send_position(2+pos); 00724 s2=1; 00725 s3=0; 00726 sendByte(0x84+kleur); 00727 send_position(2+pos); 00728 s3=1; 00729 s4=0; 00730 sendByte(0x84+kleur); 00731 send_position(2+pos); 00732 s4=1; 00733 s5=0; 00734 sendByte(0x84+kleur); 00735 send_position(2+pos); 00736 sendByte(0x84+kleur); 00737 send_position(3+pos); 00738 sendByte(0x84+kleur); 00739 send_position(4+pos); 00740 sendByte(0x84+kleur); 00741 send_position(5+pos); 00742 s5=1; 00743 00744 ///*** Eind L **** /// 00745 00746 } 00747 00748 void K(int pos, int kleur) 00749 { 00750 00751 s1=0; 00752 sendByte(0x84+kleur); 00753 send_position(2+pos); 00754 sendByte(0x84+kleur); 00755 send_position(5+pos); 00756 s1=1; 00757 s2=0; 00758 sendByte(0x84+kleur); 00759 send_position(2+pos); 00760 sendByte(0x84+kleur); 00761 send_position(4+pos); 00762 s2=1; 00763 s3=0; 00764 sendByte(0x84+kleur); 00765 send_position(2+pos); 00766 sendByte(0x84+kleur); 00767 send_position(3+pos); 00768 s3=1; 00769 s4=0; 00770 sendByte(0x84+kleur); 00771 send_position(2+pos); 00772 sendByte(0x84+kleur); 00773 send_position(4+pos); 00774 s4=1; 00775 s5=0; 00776 sendByte(0x84+kleur); 00777 send_position(2+pos); 00778 sendByte(0x84+kleur); 00779 send_position(5+pos); 00780 s5=1; 00781 00782 ///*** Eind K **** /// 00783 } 00784 00785 void J(int pos, int kleur) 00786 { 00787 00788 s1=0; 00789 sendByte(0x84+kleur); 00790 send_position(3+pos); 00791 sendByte(0x84+kleur); 00792 send_position(4+pos); 00793 s1=1; 00794 s2=0; 00795 sendByte(0x84+kleur); 00796 send_position(4+pos); 00797 s2=1; 00798 s3=0; 00799 sendByte(0x84+kleur); 00800 send_position(4+pos); 00801 s3=1; 00802 s4=0; 00803 sendByte(0x84+kleur); 00804 send_position(4+pos); 00805 s4=1; 00806 s5=0; 00807 sendByte(0x84+kleur); 00808 send_position(2+pos); 00809 sendByte(0x84+kleur); 00810 send_position(3+pos); 00811 s5=1; 00812 00813 ///** Einde J ***/ 00814 } 00815 void I(int pos, int kleur) 00816 { 00817 00818 s1=0; 00819 sendByte(0x84+kleur); 00820 send_position(3+pos); 00821 sendByte(0x84+kleur); 00822 send_position(4+pos); 00823 sendByte(0x84+kleur); 00824 send_position(5+pos); 00825 s1=1; 00826 s2=0; 00827 sendByte(0x84+kleur); 00828 send_position(4+pos); 00829 s2=1; 00830 s3=0; 00831 sendByte(0x84+kleur); 00832 send_position(4+pos); 00833 s3=1; 00834 s4=0; 00835 sendByte(0x84+kleur); 00836 send_position(4+pos); 00837 s4=1; 00838 s5=0; 00839 send_position(3+pos); 00840 sendByte(0x84+kleur); 00841 send_position(4+pos); 00842 sendByte(0x84+kleur); 00843 send_position(5+pos); 00844 //** Einde I ***/ 00845 } 00846 00847 00848 00849 void H(int pos, int kleur) 00850 { 00851 //// *** Begin H *** // 00852 s1=0; 00853 sendByte(0x84+kleur); 00854 send_position(2+pos); 00855 sendByte(0x84+kleur); 00856 send_position(5+pos); 00857 s1=1; 00858 s2=0; 00859 sendByte(0x84+kleur); 00860 send_position(2+pos); 00861 sendByte(0x84+kleur); 00862 send_position(5+pos); 00863 s2=1; 00864 s3=0; 00865 sendByte(0x84+kleur); 00866 send_position(2+pos); 00867 sendByte(0x84+kleur); 00868 send_position(3+pos); 00869 sendByte(0x84+kleur); 00870 send_position(4+pos); 00871 sendByte(0x84+kleur); 00872 send_position(5+pos); 00873 s3=1; 00874 s4=0; 00875 sendByte(0x84+kleur); 00876 send_position(2+pos); 00877 sendByte(0x84+kleur); 00878 send_position(5+pos); 00879 s4=1; 00880 s5=0; 00881 sendByte(0x84+kleur); 00882 send_position(2+pos); 00883 sendByte(0x84+kleur); 00884 send_position(5+pos); 00885 s5=1; 00886 00887 ///*** Eind H ***// 00888 } 00889 void G(int pos, int kleur) 00890 { 00891 myled=1; 00892 s1=0; 00893 sendByte(0x84+kleur); 00894 send_position(2+pos); 00895 sendByte(0x84+kleur); 00896 send_position(3+pos); 00897 sendByte(0x84+kleur); 00898 send_position(4+pos); 00899 sendByte(0x84+kleur); 00900 send_position(5+pos); 00901 s1=1; 00902 s2=0; 00903 sendByte(0x84+kleur); 00904 send_position(2+pos); 00905 s2=1; 00906 s3=0; 00907 sendByte(0x84+kleur); 00908 send_position(2+pos); 00909 sendByte(0x84+kleur); 00910 send_position(4+pos); 00911 sendByte(0x84+kleur); 00912 send_position(5+pos); 00913 s3=1; 00914 s4=0; 00915 sendByte(0x84+kleur); 00916 send_position(2+pos); 00917 sendByte(0x84+kleur); 00918 send_position(5+pos); 00919 s4=1; 00920 s5=0; 00921 sendByte(0x84+kleur); 00922 send_position(2+pos); 00923 sendByte(0x84+kleur); 00924 send_position(3+pos); 00925 sendByte(0x84+kleur); 00926 send_position(4+pos); 00927 sendByte(0x84+kleur); 00928 send_position(5+pos); 00929 s5=1; 00930 00931 /// *** Eind G *** / 00932 00933 } 00934 00935 void F(int pos, int kleur){ 00936 00937 s1=0; 00938 sendByte(0x84+kleur); 00939 send_position(2+pos); 00940 sendByte(0x84+kleur); 00941 send_position(3+pos); 00942 sendByte(0x84+kleur); 00943 send_position(4+pos); 00944 sendByte(0x84+kleur); 00945 send_position(5+pos); 00946 s1=1; 00947 s2=0; 00948 sendByte(0x84+kleur); 00949 send_position(2+pos); 00950 s2=1; 00951 s3=0; 00952 sendByte(0x84+kleur); 00953 send_position(2+pos); 00954 sendByte(0x84+kleur); 00955 send_position(3+pos); 00956 sendByte(0x84+kleur); 00957 send_position(4+pos); 00958 sendByte(0x84+kleur); 00959 send_position(5+pos); 00960 s3=1; 00961 s4=0; 00962 sendByte(0x84+kleur); 00963 send_position(2+pos); 00964 s4=1; 00965 s5=0; 00966 sendByte(0x84+kleur); 00967 send_position(2+pos); 00968 s5=1; 00969 00970 /// **** Eind F ****/// 00971 00972 } 00973 00974 void E(int pos, int kleur) 00975 { 00976 00977 s1=0; 00978 sendByte(0x84+kleur); 00979 send_position(2+pos); 00980 sendByte(0x84+kleur); 00981 send_position(3+pos); 00982 sendByte(0x84+kleur); 00983 send_position(4+pos); 00984 sendByte(0x84+kleur); 00985 send_position(5+pos); 00986 s1=1; 00987 s2=0; 00988 sendByte(0x84+kleur); 00989 send_position(2+pos); 00990 s2=1; 00991 s3=0; 00992 sendByte(0x84+kleur); 00993 send_position(2+pos); 00994 sendByte(0x84+kleur); 00995 send_position(3+pos); 00996 sendByte(0x84+kleur); 00997 send_position(4+pos); 00998 sendByte(0x84+kleur); 00999 send_position(5+pos); 01000 s3=1; 01001 s4=0; 01002 sendByte(0x84+kleur); 01003 send_position(2+pos); 01004 s4=1; 01005 s5=0; 01006 sendByte(0x84+kleur); 01007 sendByte(0x84+kleur); 01008 send_position(2+pos); 01009 sendByte(0x84+kleur); 01010 send_position(3+pos); 01011 sendByte(0x84+kleur); 01012 send_position(4+pos); 01013 sendByte(0x84+kleur); 01014 send_position(5+pos); 01015 s5=1; 01016 01017 ///*** Eind E ***/// 01018 } 01019 void D(int pos, int kleur) 01020 { 01021 s1=0; 01022 sendByte(0x84+kleur); 01023 send_position(2+pos); 01024 sendByte(0x84+kleur); 01025 send_position(3+pos); 01026 sendByte(0x84+kleur); 01027 send_position(4+pos); 01028 s1=1; 01029 s2=0; 01030 sendByte(0x84+kleur); 01031 send_position(2+pos); 01032 sendByte(0x84+kleur); 01033 send_position(5+pos); 01034 s2=1; 01035 s3=0; 01036 sendByte(0x84+kleur); 01037 send_position(2+pos); 01038 sendByte(0x84+kleur); 01039 send_position(5+pos); 01040 s3=1; 01041 s4=0; 01042 sendByte(0x84+kleur); 01043 send_position(2+pos); 01044 sendByte(0x84+kleur); 01045 send_position(5+pos); 01046 s4=1; 01047 s5=0; 01048 sendByte(0x84+kleur); 01049 send_position(2+pos); 01050 sendByte(0x84+kleur); 01051 send_position(3+pos); 01052 sendByte(0x84+kleur); 01053 send_position(4+pos); 01054 s5=1; 01055 01056 //**** Eind D **** /// 01057 } 01058 01059 void C(int pos, int kleur) 01060 { 01061 s1=0; 01062 sendByte(0x84+kleur); 01063 send_position(3+pos); 01064 sendByte(0x84+kleur); 01065 send_position(4+pos); 01066 sendByte(0x84+kleur); 01067 send_position(5+pos); 01068 s1=1; 01069 s2=0; 01070 sendByte(0x84+kleur); 01071 send_position(2+pos); 01072 s2=1; 01073 s3=0; 01074 sendByte(0x84+kleur); 01075 send_position(2+pos); 01076 s3=1; 01077 s4=0; 01078 sendByte(0x84+kleur); 01079 send_position(2+pos); 01080 s4=1; 01081 s5=0; 01082 sendByte(0x84+kleur); 01083 send_position(3+pos); 01084 sendByte(0x84+kleur); 01085 send_position(4+pos); 01086 sendByte(0x84+kleur); 01087 send_position(5+pos); 01088 s5=1; 01089 01090 /// ***** Eind C ***/ 01091 } 01092 01093 void B(int pos, int kleur) 01094 { 01095 01096 01097 s1=0; 01098 sendByte(0x84+kleur); 01099 send_position(2+pos); 01100 sendByte(0x84+kleur); 01101 send_position(3+pos); 01102 sendByte(0x84+kleur); 01103 send_position(4+pos); 01104 s1=1; 01105 s2=0; 01106 sendByte(0x84+kleur); 01107 send_position(2+pos); 01108 sendByte(0x84+kleur); 01109 send_position(5+pos); 01110 s2=1; 01111 s3=0; 01112 sendByte(0x84+kleur); 01113 send_position(2+pos); 01114 sendByte(0x84+kleur); 01115 send_position(3+pos); 01116 sendByte(0x84+kleur); 01117 send_position(4+pos); 01118 s3=1; 01119 s4=0; 01120 sendByte(0x84+kleur); 01121 send_position(2+pos); 01122 sendByte(0x84+kleur); 01123 send_position(5+pos); 01124 s4=1; 01125 s5=0; 01126 sendByte(0x84+kleur); 01127 send_position(2+pos); 01128 sendByte(0x84+kleur); 01129 send_position(3+pos); 01130 sendByte(0x84+kleur); 01131 send_position(4+pos); 01132 s5=1; 01133 01134 //***** Eind B *****/ 01135 } 01136 01137 void A(int pos,int kleur) 01138 { 01139 01140 01141 s1=0; 01142 sendByte(0x84+kleur); 01143 send_position(4+pos); 01144 s1=1; 01145 s2=0; 01146 sendByte(0x84+kleur); 01147 send_position(3+pos); 01148 sendByte(0x84+kleur); 01149 send_position(5+pos); 01150 s2=1; 01151 s3=0; 01152 sendByte(0x84+kleur); 01153 send_position(2+pos); 01154 sendByte(0x84+kleur); 01155 send_position(3+pos); 01156 sendByte(0x84+kleur); 01157 send_position(4+pos); 01158 sendByte(0x84+kleur); 01159 send_position(5+pos); 01160 sendByte(0x84+kleur); 01161 send_position(6+pos); 01162 s3=1; 01163 s4=0; 01164 s5=0; 01165 sendByte(0x84+kleur); 01166 send_position(2+pos); 01167 sendByte(0x84+kleur); 01168 send_position(6+pos); 01169 s4=1; 01170 s5=1; 01171 01172 //*********** Einde Letter A ****//// 01173 } 01174 int main() { 01175 int i,x; 01176 fade.period_us(1); 01177 fade=0.5; 01178 x=100; // aantal leds in de strip 01179 s1=0; 01180 s2=0; 01181 s3=0; 01182 01183 s4=0; 01184 s5=0; 01185 01186 for(i=0 ; i < x ; i++) // alle leds uitzetten om te kunnen beginnen. 01187 { 01188 sendByte(128); 01189 latchen(); 01190 } 01191 s1=1; 01192 s2=1; 01193 s3=1; 01194 s4=1; 01195 s5=1; 01196 01197 while(1) 01198 { 01199 int x; 01200 for(i=0;i<92;i++){ 01201 erase(); 01202 01203 01204 01205 01206 01207 01208 if(i>0){ 01209 01210 L(0+i-6,0); 01211 } 01212 01213 if(i>7){ 01214 N(0+i-13,0); 01215 } 01216 01217 if(i>11 ){ 01218 punt(0+i-17,9); 01219 } 01220 01221 if(i>14 ){ 01222 D(0+i-20,0); 01223 } 01224 01225 if(i>20){ 01226 N(0+i-26,14); 01227 } 01228 01229 if(i>26){ 01230 U(0+i-32,-3); 01231 } 01232 01233 if(i>32){ 01234 O(0+i-38,0x11); 01235 } 01236 01237 if(i>38){ 01238 S(0+i-44,0); 01239 } 01240 01241 if(i>44){ 01242 N(0+i-50,9); 01243 } 01244 01245 if(i>50){ 01246 L(0+i-56,14); 01247 } 01248 01249 wait_ms(900); 01250 01251 } 01252 01253 01254 01255 } 01256 01257 }
Generated on Tue Jul 19 2022 20:49:12 by
1.7.2