Cet afficheur a été réalisé pour mon ami Pat d’Emmabuntüs
Pat avait besoin d’un visuel attractif a poser sur stand lors de manifestations, notamment pour la fête de l’Huma, et il m’a proposé de réaliser ce projet.
La BoiBoite a été réalisée a l’aide du script OpenSCADBoxes et découpée avec la découpe laser de LABSud dans du MDF de 3.3mm d’épaisseur, ce petit script est vraiment génial pour réaliser rapidement de chouettes BoiBoites.
Le logo a été transformé a l’aide du logiciel Image2Code, autre piste testée image2cpp.
Je suis parti du logo d’origine en svg convertis en png de 26×26 pixels
Electronique:
Une Arduino MEGA 2560 (copie chinoise)
Une alimentation 5 Volts 4 ampères
Toute les sources sont disponibles au téléchargement sur Sourceforge.
Librairies nécessaires: RGB-matrix-Panel et Adafruit_GFX
Code Arduino de base utilisé sur la vidéo ci-dessus.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
//Emmabuntüs l'informatique libre et éthique pour tous ! //https://www.sparkfun.com/products/12584 //http://javl.github.io/image2cpp/ // scrolltext demo for Adafruit RGBmatrixPanel library. // Demonstrates double-buffered animation on our 16x32 RGB LED matrix: // http://www.adafruit.com/products/420 // Written by Limor Fried/Ladyada & Phil Burgess/PaintYourDragon // for Adafruit Industries. // BSD license, all text above must be included in any redistribution. #include <Adafruit_GFX.h> // Core graphics library #include <RGBmatrixPanel.h> // Hardware-specific library // Similar to F(), but for PROGMEM string pointers rather than literals #define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr #define TextFactor 1 //ff 4 +/- texte grand #define CLK 11 // MUST be on PORTB! (Use pin 11 on Mega) //#define LAT A3 #define OE 9 #define A A0 #define B A1 #define C A2 #define LAT 10 //ff #define D A3 //ff // Last parameter = 'true' enables double-buffering, for flicker-free, // buttery smooth animation. Note that NOTHING WILL SHOW ON THE DISPLAY // until the first call to swapBuffers(). This is normal. //RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, true);//ff RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, true);//ff // Double-buffered mode consumes nearly all the RAM available on the // Arduino Uno -- only a handful of free bytes remain. Even the // following string needs to go in PROGMEM: //const char str[] PROGMEM = "Emmabuntus l'informatique libre et ethique pour tous !"; //ff const char str[] = "Emmabuntus l'informatique libre et ethique pour tous !"; //ff //const char str[] = "Emmabuntus"; int textX = matrix.width(), //textMin = sizeof(str) * -12, //ff textMin = - ( sizeof(str) * TextFactor * 6), //ff hue = 0; int8_t ball[3][4] = { { 3, 0, 1, 1 }, // Initial X,Y pos & velocity for 3 bouncy balls { 17, 15, 1, -1 }, { 27, 4, -1, 1 } }; static const uint16_t ballcolor[3] = { 0x0080, // Green=1 0x0002, // Blue=1 0x1000 // Red=1 }; const unsigned char logo2 [] PROGMEM = { // 'logo-pat' 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x00, 0x07, 0xfe, 0x00, 0x00, 0x0e, 0x0f, 0x00, 0x00, 0x1c, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x78, 0x00, 0x03, 0x00, 0xf8, 0x00, 0x01, 0x80, 0x78, 0x00, 0x03, 0x80, 0x30, 0x00, 0x03, 0x00, 0x00, 0x1c, 0x07, 0x00, 0x00, 0x0e, 0x0f, 0x00, 0x00, 0x0f, 0xfe, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x20, }; const unsigned char logo [] PROGMEM = { // 'logo-pat' 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0f, 0xfc, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0xf8, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0xf0, 0x03, 0xc0, 0x00, 0x78, 0x03, 0xc0, 0x00, 0x3c, 0x07, 0x80, 0x00, 0x1c, 0x07, 0x00, 0x00, 0x1e, 0x0f, 0x00, 0x00, 0x0e, 0x06, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00, 0x0f, 0x02, 0x00, 0x00, 0x0f, 0x02, 0x00, 0x00, 0x0f, 0x02, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00, 0x0f, 0x07, 0x00, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x1e, 0x07, 0x80, 0x00, 0x3c, 0x03, 0xc0, 0x00, 0x3c, 0x03, 0xe0, 0x00, 0x78, 0x01, 0xf0, 0x00, 0xf0, 0x00, 0xfc, 0x07, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x1f, 0xff, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, }; void setup() { matrix.begin(); matrix.setTextWrap(false); // Allow text to run off right edge //matrix.setTextSize(2);//ff matrix.setTextSize(TextFactor);//ff /* matrix.drawBitmap(0, 0, logo, 32, 32, matrix.Color444(50, 0, 50)); //Violet //matrix.swapBuffers(false); matrix.drawBitmap(0, 0, logo2, 32, 32, matrix.Color444(255, 255, 0)); //Jaune matrix.swapBuffers(false); while(1); */ } void loop() { byte i; // Clear background matrix.fillScreen(0); // Bounce three balls around for(i=2; i<3; i++) { //for(i=0; i<3; i++) { // Draw 'ball' matrix.fillCircle(ball[i][0], ball[i][1], 5, ballcolor[i]);//pgm_read_word(&ballcolor[i]));//ff // Update X, Y position ball[i][0] += ball[i][2]; ball[i][1] += ball[i][3]; // Bounce off edges if((ball[i][0] == 0) || (ball[i][0] == (matrix.width() - 1))) ball[i][2] *= -1; if((ball[i][1] == 0) || (ball[i][1] == (matrix.height() - 1))) ball[i][3] *= -1; } // Draw big scrolly text on top matrix.setTextColor(matrix.ColorHSV(hue, 255, 255, true));//ff //matrix.setTextColor(matrix.ColorHSV(hue, 255, 128u, true));//ff moins lumineux matrix.setCursor(textX, 1); // matrix.print(F2(str)); matrix.print(str); // Move text left (w/wrap), increase hue if((--textX) < textMin-32) textX = matrix.width(); hue += 7;//ff 7 if(hue >= 1536) hue -= 1536; matrix.drawBitmap(textX-textMin, 0, logo, 32, 32, matrix.Color444(50, 0, 50)); //Violet matrix.drawBitmap(textX-textMin, 0, logo2, 32, 32, matrix.Color444(255, 255, 0)); //Jaune matrix.swapBuffers(false); } |