Shield Ecran couleur graphique LCD 128x128

Utilisation de capteurs et composants électroniques avec Arduino.
Une fiche de tutoriel pour chaque.

Shield Ecran couleur graphique LCD 128x128

Messagepar tiptop » Jeu 16 Oct 2014 15:26

Utilisation du Shield Ecran couleur graphique LCD 128x128 pour Arduino (Nokia 6100)

Image.Image.Image

Composants utilisés

Principe de fonctionnement
Cet petit écran à cristaux liquides LCD de 128x128 pixels en couleur s'adapte directement sur votre carte Arduino (shield). Il comporte également 3 boutons poussoirs.
Il n'utilise que 4 pins Arduino + 3 pour les boutons.

Caractéristiques
  • Affichage 4096 couleurs, 128 x 128 pixels.
  • 9 couleurs prédéfinies (rouge, vert, bleu, cyan, magenta, jaune, brun, orange, rose) et noir et blanc.
  • Rétro-éclairage LED blanc puissant.
  • Fonctionne avec le 5V de l'Arduino.

Il utilise soit le contrôleur S1D15G10 d'Epson soit le contrôleur Philips PCF8833.
  • Si l'écran était protégé par un film rouge, avec un gros driver en haut de l'écran, il est piloté par un driver Epson.
  • Si l'écran était protégé par un film bleu ,avec un petit driver en haut de l'écran, il est piloté par un driver Phillips.
    http://www.electricstuff.co.uk/noklcd.html
Dans le cas présent c'est un modèle PHILIPS.
Il faudra donc l'initialiser avec
Code: Tout sélectionner
lcd.init(PHILLIPS);
lcd.contrast(-68);


Brochage du shield
Il y a 3 boutons poussoirs, sur les pins D3-D5.

L'interface LCD utilise les pins D8, 9, 11, 13.

LCD Pin -> Arduino Pin
  • Reset (RES) -> pin 8
  • Chip-select -> pin 9
  • Data in/out (DIO) ->pin 11
  • Serial Clock (SCK) ->pin 13

Montage et utilisation
Monter et souder les 4 barrettes de support sur le shield, l'emboîter sur la carte Arduino (Uno).
Fixer l'écran avec un point de colle s'il n'est pas monté (attention au petit connecteur).

Installation de la librairie ColorLCDShield
Aller ici https://github.com/jimblom/ColorLCDShield
pour télécharger le fichier Zip, décompresser et copier dans votre dossier .\arduino-1.0.x\libraries
Le dossier de librairie et d'exemples est à renommer ColorLCDShield


Redémarrer l'IDE Arduino pour assurer la prise en compte de l'installation de la librairie.

Premier programme : Affichage d'une horloge sur l'écran

Aller dans Menu de l'IDE Arduino et charger le code d'exemple :
Fichiers/Exemples/ColorLCDShield/Examples/ChronoLCD_Color
dans la carte Uno, l'écran va alors afficher une horloge qui tourne.
Image

Le programme :
Code: Tout sélectionner
/*
  ChronoLCD Color - An example sketch for the Color LCD Shield Library
  by: Jim Lindblom
  SparkFun Electronics
  date: 6/23/11
  license: CC-BY SA 3.0 - Creative commons share-alike 3.0
  use this code however you'd like, just keep this license and
  attribute. Let me know if you make hugely, awesome, great changes.
 
  This sketch draws an analog and digital clock on the Color LCD
  Shield. You can also use the on-board buttons to set the hours
  and minutes.
 
  Use the defines at the top of the code to set the initial time.
  You can also adjust the size and color of the clock.
 
  To set the time, first hit S3. Then use S1 and S2 to adjust the
  hours and minutes respsectively. Hit S3 to start the clock
  back up.
 
  This example code should give you a good idea of how to use
  the setCircle, setLine, and setStr functions of the Color LCD
  Shield Library.
*/
#include <ColorLCDShield.h>

// Enter the time below in 12-hr format
#define HOURS 10
#define MINUTES 21
#define SECONDS 00
#define AMPM 0  // enter 0 for AM, 1 for PM

#define CLOCK_RADIUS 45  // radius of clock face
#define CLOCK_CENTER 50  // If you adjust the radius, you'll probably want to adjust this
#define H_LENGTH  25  // length of hour hand
#define M_LENGTH  35  // length of minute hand
#define S_LENGTH  43  // length of second hand

#define BACKGROUND  BLACK  // room for growth, adjust the background color according to daylight
#define C_COLOR  RED  // This is the color of the clock face, and digital clock
#define H_COLOR  BLUE  // hour hand color
#define M_COLOR  GREEN  // minute hand color
#define S_COLOR  YELLOW  // second hand color

LCDShield lcd;

int hours, minutes, seconds, ampm;
int buttonPins[3] = {3, 4, 5};

void setup()
{
  /* Set up the button pins as inputs, set pull-up resistor */
  for (int i=0; i<3; i++)
  {
    pinMode(buttonPins[i], INPUT);
    digitalWrite(buttonPins[i], HIGH);
  }
 
  hours = HOURS;
  minutes = MINUTES;
  seconds = SECONDS;
  ampm = AMPM;
 
  /* Initialize the LCD, set the contrast, clear the screen */
  lcd.init(PHILIPS);
  lcd.contrast(-63);
  lcd.clear(BACKGROUND);
 
  drawClock();  // Draw the clock face, this includes 12, 3, 6, 9
  displayAnalogTime(hours, minutes, seconds);  // Draw the clock hands
  displayDigitalTime(hours, minutes, seconds, ampm);  // Draw the digital clock text
}

void loop()
{
  /* We'll run around checking for button presses,
     until it's been a second */
  while(millis() % 1000)
  {
    if (!digitalRead(buttonPins[2]))
      setTime();  // If S3 was pressed, go set the time
  }
 
  /* We'll get here if it's been a second. We need to increase
  seconds by 1 and then go from there */
  seconds++;
  if (seconds >= 60)
  {
    seconds = 0;  // If seconds is 60, set it back to 0
    minutes++;    // and increase minutes by 1
    if (minutes >= 60)
    {
      minutes = 0;  // If minutes is 60, set it back to 0
      hours++;      // and increase hours by 1
      if (hours == 12)
        ampm ^= 1;  // If it's 12 o'clock, flip ampm
      if (hours >= 13)
        hours = 1;  // If hours is 13, set it to 1. 12-hr clock.
    }
  }
  /* Once each second, we'll redraw the clock with new values */
  drawClock();
  displayAnalogTime(hours, minutes, seconds);
  displayDigitalTime(hours, minutes, seconds, ampm);
}
/*
  setTime uses on-shield switches S1, S2, and S3 to set the time
  pressing S3 will exit the function. S1 increases hours, S2
  increases seconds.
 */
void setTime()
{
  /* Reset the clock to midnight */
  seconds = 0;
  minutes = 0;
  hours = 12;
  ampm = 0;
 
  /* Draw the clock, so we can see the new time */
  drawClock();
  displayAnalogTime(hours, minutes, seconds);
  displayDigitalTime(hours, minutes, seconds, ampm);
   
  while (!digitalRead(buttonPins[2]))
    ;  // wait till they let go of S1
 
  /* We'll run around this loop until S3 is pressed again */
  while(digitalRead(buttonPins[2]))
  {
    /* If S1 is pressed, we'll update the hours */
    if (!digitalRead(buttonPins[0]))
    {
      hours++;  // Increase hours by 1
      if (hours == 12)
        ampm ^= 1;  // Flip am/pm if it's 12 o'clock
      if (hours >= 13)
        hours = 1;  // Set hours to 1 if it's 13. 12-hour clock.
       
      /* and update the clock, so we can see it */
      drawClock();
      displayAnalogTime(hours, minutes, seconds);
      displayDigitalTime(hours, minutes, seconds, ampm);
    }
    if (!digitalRead(buttonPins[1]))
    {
      minutes++;  // Increase minutes by 1
      if (minutes >= 60)
        minutes = 0;  // If minutes is 60, set it back to 0
       
      /* and update the clock, so we can see it */
      drawClock();
      displayAnalogTime(hours, minutes, seconds);
      displayDigitalTime(hours, minutes, seconds, ampm);
    }
  }
  /* Once S3 is pressed, we'll exit, but not until it's released */
  while(!digitalRead(buttonPins[2]))
    ;
}

/*
  displayDigitalTime() takes in values for hours, minutes, seconds
  and am/pm. It'll print the time, in digital format, on the
  bottom of the screen.
*/
void displayDigitalTime(int h, int m, int s, int ap)
{
  char timeChar[12];
 
  if (!ap)
  {
    sprintf(timeChar, "%.2d:%.2d:%.2d AM", h, m, s);
  }
  else
  {
    sprintf(timeChar, "%.2d:%.2d:%.2d PM", h, m, s);
  }
  /* Print the time on the clock */
  lcd.setStr(timeChar, CLOCK_CENTER + CLOCK_RADIUS + 4, 22,
              C_COLOR, BACKGROUND);
}

/*
  drawClock() simply draws the outer circle of the clock, and '12',
  '3', '6', and '9'. Room for growth here, if you want to customize
  your clock. Maybe add dashe marks, or even all 12 digits.
*/
void drawClock()
{
  /* Draw the circle */
  lcd.setCircle(CLOCK_CENTER, 66, CLOCK_RADIUS, C_COLOR);
 
  /* Print 12, 3, 6, 9, a lot of arbitrary values are used here
     for the coordinates. Just used trial and error to get them
     into a nice position. */
  lcd.setStr("12", CLOCK_CENTER - CLOCK_RADIUS, 66-9, C_COLOR, BACKGROUND);
  lcd.setStr("3", CLOCK_CENTER - 9, 66 + CLOCK_RADIUS - 12, C_COLOR, BACKGROUND);
  lcd.setStr("6", CLOCK_CENTER + CLOCK_RADIUS - 18, 66-4, C_COLOR, BACKGROUND);
  lcd.setStr("9", CLOCK_CENTER - 9, 66 - CLOCK_RADIUS + 4, C_COLOR, BACKGROUND);
}

/*
  displayAnalogTime() draws the three clock hands in their proper
  position. Room for growth here, I'd like to make the clock hands
  arrow shaped, or at least thicker and more visible.
*/
void displayAnalogTime(int h, int m, int s)
{
  double midHours;  // this will be used to slightly adjust the hour hand
  static int hx, hy, mx, my, sx, sy;
 
  /* Adjust time to shift display 90 degrees ccw
     this will turn the clock the same direction as text */
  h -= 3;
  m -= 15;
  s -= 15;
  if (h <= 0)
    h += 12;
  if (m < 0)
    m += 60;
  if (s < 0)
    s += 60;
   
  /* Delete old lines: */
  lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+sx, 66+sy, BACKGROUND);  // delete second hand
  lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+mx, 66+my, BACKGROUND);  // delete minute hand
  lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+hx, 66+hy, BACKGROUND);  // delete hour hand
 
  /* Calculate and draw new lines: */
  s = map(s, 0, 60, 0, 360);  // map the 0-60, to "360 degrees"
  sx = S_LENGTH * sin(3.14 * ((double) s)/180);  // woo trig!
  sy = S_LENGTH * cos(3.14 * ((double) s)/180);  // woo trig!
  lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+sx, 66+sy, S_COLOR);  // print second hand
 
  m = map(m, 0, 60, 0, 360);  // map the 0-60, to "360 degrees"
  mx = M_LENGTH * sin(3.14 * ((double) m)/180);  // woo trig!
  my = M_LENGTH * cos(3.14 * ((double) m)/180);  // woo trig!
  lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+mx, 66+my, M_COLOR);  // print minute hand
 
  midHours = minutes/12;  // midHours is used to set the hours hand to middling levels between whole hours
  h *= 5;  // Get hours and midhours to the same scale
  h += midHours;  // add hours and midhours
  h = map(h, 0, 60, 0, 360);  // map the 0-60, to "360 degrees"
  hx = H_LENGTH * sin(3.14 * ((double) h)/180);  // woo trig!
  hy = H_LENGTH * cos(3.14 * ((double) h)/180);  // woo trig!
  lcd.setLine(CLOCK_CENTER, 66, CLOCK_CENTER+hx, 66+hy, H_COLOR);  // print hour hand
}


Ce code affiche une horloge avec des aiguilles qui tournent chaque seconde.

Second programme

Aller dans Fichiers/Exemples/ColorLCDShield/Examples/TestPattern et charger le programme TestPattern sur la carte Arduino.

L'écran va alors afficher un logo Sparkfun sous forme graphique, et une barre de rectangles colorés en dessous.
Les boutons poussoirs font varier le contraste. (S1 diminue,S2 augmente).
Image

Code: Tout sélectionner
/*
  TestPattern - An example sketch for the Color LCD Shield Library
  by: Jim Lindblom
  SparkFun Electronics
  date: 6/23/11
  license: CC-BY SA 3.0 - Creative commons share-alike 3.0
  use this code however you'd like, just keep this license and
  attribute. Let me know if you make hugely, awesome, great changes.

  This sketch has example usage of the Color LCD Shield's three
  buttons. It also shows how to use the setRect and contrast
  functions.
 
  Hit S1 to increase the contrast, S2 decreases the contrast, and
  S3 sets the contrast back to the middle.
*/
#include <ColorLCDShield.h>

LCDShield lcd;

int buttons[3] = {3, 4, 5};  // S1 = 3, S2 = 4, S3 = 5
signed char cont = -51;  // Philips medium contrast
//signed char cont = 40;  // Epson medium contrast

void setup()
{
  Serial.begin(9600);
  for (int i=0; i<3; i++)
  {
    pinMode(buttons[i], INPUT);  // Set buttons as inputs
    digitalWrite(buttons[i], HIGH);  // Activate internal pull-up
  }
 
  // Initialize the LCD, try using EPSON if it's not working
  lcd.init(PHILIPS); 
  // lcd.init(PHILIPS, 1);  // Philips init with colors swapped. (Try this if red makes blue, etc).
  lcd.contrast(cont);  // Initialize contrast
  lcd.clear(WHITE);  // Set background to white
  lcd.printLogo();  // Print SparkFun test logo
  testPattern();  // Print color bars on bottom of screen
}

void loop()
{
  while(digitalRead(buttons[0])&&digitalRead(buttons[1])&&digitalRead(buttons[2]))
    ;  // Wait, do nothing, until a button is pressed
  if (!digitalRead(buttons[0]))  // If S1 is hit, increase contrast
  {
    cont++;
    if (cont > 63) // Philips contrast goes from 63 to -64
      cont = -64;
  }
  else if (!digitalRead(buttons[1]))  // If s2 is hit, decrease contrast
  {
    cont--;
    if (cont < -64)
      cont = 63;
  }
  else if (!digitalRead(buttons[2]))  // If S3 is hit, reset contrast
  {
    cont = 0;
  }
  lcd.contrast(cont);  // give LCD contrast command
  Serial.println(cont);
 
  delay(100);  // Delay to give each button press a little more meaning
}

void testPattern()
{
  lcd.setRect(80, 2, 131, 19, 1, WHITE);
  lcd.setRect(80, 19, 131, 35, 1, YELLOW);
  lcd.setRect(80, 35, 131, 51, 1, CYAN);
  lcd.setRect(80, 51, 131, 67, 1, GREEN);
  lcd.setRect(80, 67, 131, 83, 1, MAGENTA);
  lcd.setRect(80, 83, 131, 99, 1, RED);
  lcd.setRect(80, 99, 131, 115, 1, BLUE);
  lcd.setRect(80, 115, 131, 131, 1, BLACK);
}



Troisième programme

Aller dans Fichiers/Exemples/ColorLCDShield/Examples/ZaniCircles et charger le programme ZaniCircles sur la carte Arduino.
Ce programme montre comment utiliser SetCircle et SetPixel à partir de la librairie.
Les cercles se déplacent de façon aléatoire.
Image

Code: Tout sélectionner
/*
  ZanyCircles - An example sketch for the Color LCD Shield Library
  by: Jim Lindblom
  SparkFun Electronics
  date: 6/23/11
  license: CC-BY SA 3.0 - Creative commons share-alike 3.0
  use this code however you'd like, just keep this license and
  attribute. Let me know if you make hugely, awesome, great changes.
 
  This simple sketch shows how you can use setCircle and setPixel
  with the Color LCD Shield library.
*/
#include <ColorLCDShield.h>

#define CIRCLES 10  // Number of zany circles in display
#define BACKGROUND ORANGE  // Color of background
#define FOREGROUND BLUE  // color of circles

int radius = 3;  // size of circles
int jump = 5;  // +/- of possible jump
int xCir[CIRCLES];  // center points of circles
int yCir[CIRCLES];  // cetner points of circles

LCDShield lcd;

void setup()
{
  lcd.init(PHILIPS);  // Try EPSON if this doesn't work. If colors are swapped try init(PHILIPS, 1)
  lcd.contrast(-68);  // Feel free to change this for visibility, values between 0 and 60
  lcd.clear(BACKGROUND);
 
  // Initilize all circles' center points
  for (int i=0; i<CIRCLES; i++)
  {
    //xCir[i] = random(2, 131);  // random starting points
    //yCir[i] = random(2, 131);
    xCir[i] = 66;  // start in the middle
    yCir[i] = 66;
   
    // Circles must be stuck inside the box:
    if (xCir[i] >= 131-radius)
      xCir[i] = 131-radius;
    if (xCir[i] <= radius)
      xCir[i] = radius;
    if (yCir[i] >= 131-radius)
      yCir[i] = 131-radius;
    if (yCir[i] <= radius)
      yCir[i] = radius;
  }
}

void loop()
{
  for (int i=0; i<CIRCLES; i++)
  {
    // add a random number to x, y
    xCir[i] += random(-jump, jump+1);
    yCir[i] += random(-jump, jump+1);
   
    // Circles must be stuck inside the box:
    if (xCir[i] >= 131-radius)
      xCir[i] = 131-radius;
    if (xCir[i] <= radius)
      xCir[i] = radius;
    if (yCir[i] >= 131-radius)
      yCir[i] = 131-radius;
    if (yCir[i] <= radius)
      yCir[i] = radius;
  }
  for (int i=0; i<CIRCLES; i++)
  {
    for (int j=1; j<=radius; j++)
    {
      lcd.setCircle(xCir[i], yCir[i], j, FOREGROUND);  // draw the new circle
      lcd.setPixel(FOREGROUND, xCir[i], yCir[i]);  // fill in the center of the new circle
    }
  }
  delay(50);  // Little delay for visibility
  for (int i=0; i<CIRCLES; i++)
  {   
    for (int j=1; j<=radius; j++)
    {
      lcd.setCircle(xCir[i], yCir[i], j, BACKGROUND);  // clear the circle
      lcd.setPixel(BACKGROUND, xCir[i], yCir[i]);  // clear center of circle
    }
  }
}


Méthodes de programmation
Pour colorier le fond d'écran
Code: Tout sélectionner
lcd.clear(colour);


Pour écrire du texte (8 lignes de 16 caractères) en couleur, sur fond coloré
Code: Tout sélectionner
lcd.setStr("text", y,x, foreground colour, background colour);


Image

Exemple
Code: Tout sélectionner
// Example 28.1
#include "ColorLCDShield.h"
LCDShield lcd;
 
void setup()
{
 // following two required for LCD
 lcd.init(PHILIPS);
 lcd.contrast(-63); // sets LCD contrast (value between 0~63)
}
 
void loop()
{
 lcd.clear(BLACK);
 lcd.setStr("ABCDefghiJKLMNOP", 0,2, WHITE, BLACK);
 lcd.setStr("0123456789012345", 15,2, RED, BLACK);
 lcd.setStr("ABCDefghiJKLMNOP", 30,2, YELLOW, BLACK);
 lcd.setStr("0123456789012345", 45,2, WHITE, GREEN);
 lcd.setStr("ABCDefghiJKLMNOP", 60,2, YELLOW, RED);
 lcd.setStr("0123456789012345", 75,2, BLACK,WHITE);
 lcd.setStr("ABCDefghiJKLMNOP", 90,2, WHITE, BLUE);
 lcd.setStr("0123456789012345", 105,2, GREEN, BLACK);
 do {} while (1>0);
}


Afficher des fonds de couleur
Code: Tout sélectionner
 
int del = 1000;
#include "ColorLCDShield.h"
LCDShield lcd;
void setup()
{
  // following two required for LCD
  lcd.init(PHILIPS);
  lcd.contrast(63); // sets LCD contrast (value between 0~63)
}
 
void loop()
{
 lcd.clear(WHITE);
 lcd.setStr("White", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(BLACK);
 lcd.setStr("Black", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(YELLOW);
 lcd.setStr("Yellow", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(PINK);
 lcd.setStr("Pink", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(MAGENTA);
 lcd.setStr("Magenta", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(CYAN);
 lcd.setStr("Cyan", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(BROWN);
 lcd.setStr("Brown", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(ORANGE);
 lcd.setStr("Orange", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(BLUE);
 lcd.setStr("Blue", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(RED);
 lcd.setStr("Red", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(GREEN);
 lcd.setStr("Green", 39,40, WHITE, BLACK);
 delay(del);
}


Pour afficher un seul pixel on se sert de
Code: Tout sélectionner
lcd.setPixel(int colour, Y, X);


Pour tracer un trait, un rectangle et un cercle :
Code: Tout sélectionner
lcd.setLine(x0, y0, x1, y1, COLOUR);
lcd.setRect(x0, y0, x1, y1, fill, COLOUR);
lcd.setCircle(x, y, radius, COLOUR);



Exemple d'affichages graphiques
Image.Image.
Image

Code: Tout sélectionner
// Example 28.3

#include "ColorLCDShield.h"
LCDShield lcd;
int del = 1000;
int xx, yy = 0;

void setup()
{
  lcd.init(PHILIPS);
  lcd.contrast(63); // sets LCD contrast (value between 0~63)
  lcd.clear(BLACK);
  randomSeed(analogRead(0));
}

void loop()
{
  lcd.setStr("Graphic Function", 40,3, WHITE, BLACK);
  lcd.setStr("Test Sketch", 55, 20, WHITE, BLACK);
  delay(5000);
  lcd.clear(BLACK);
  lcd.setStr("lcd.setPixel", 40,20, WHITE, BLACK);
  delay(del);
  lcd.clear(BLACK);
  for (int a=0; a<500; a++)
  {
    xx=random(160);
    yy=random(160);
    lcd.setPixel(WHITE, yy, xx);
    delay(10);
  }
  delay(del);
  lcd.clear(BLACK);
  lcd.setStr("LCDDrawCircle", 40,10, WHITE, BLACK);
  delay(del);
  lcd.clear(BLACK);
  for (int a=0; a<2; a++)
  {
    for (int b=1; b<6; b++)
    {
      xx=b*5;
      lcd.setCircle(32, 32, xx, WHITE);
      delay(200);
      lcd.setCircle(32, 32, xx, BLACK);
      delay(200);
    }
  }
  lcd.clear(BLACK);
  for (int a=0; a<3; a++)
  {
    for (int b=1; b<12; b++)
    {
      xx=b*5;
      lcd.setCircle(32, 32, xx, WHITE);
      delay(100);
    }
    lcd.clear(BLACK);
  }
  lcd.clear(BLACK);
  for (int a=0; a<3; a++)
  {
    for (int b=1; b<12; b++)
    {
      xx=b*5;
      lcd.setCircle(32, 32, xx, WHITE);
      delay(100);
    }
    lcd.clear(BLACK);
  }
  delay(del);
  lcd.clear(BLACK);
  lcd.setStr("LCDSetLine", 40,10, WHITE, BLACK);
  delay(del);
  lcd.clear(BLACK);
  for (int a=0; a<160; a++)
  {
    xx=random(160);
    lcd.setLine(a, 1, xx, a, WHITE);
    delay(10);
  }
  lcd.clear(BLACK);
  lcd.setStr("LCDSetRect", 40,10, WHITE, BLACK);
  delay(del);
  lcd.clear(BLACK);
  for (int a=0; a<10; a++)
  {
    lcd.setRect(32,32,64,64,0,WHITE);
    delay(200);
    lcd.clear(BLACK);
    lcd.setRect(32,32,64,64,1,WHITE);
    delay(200);
    lcd.clear(BLACK);
  }
  lcd.clear(BLACK);
}


Références
La librairie à télécharger et installer https://github.com/jimblom/ColorLCDShield

ColorLCDShield (descriptif de l'écran, en anglais, sur Sparkfun)
https://www.sparkfun.com/products/retired/9363

Un exemple de code (en anglais) pour dessiner sur l'écran
https://www.sparkfun.com/tutorials/286

Le schéma technique
https://www.sparkfun.com/datasheets/Dev ... ld-v12.pdf

Autre tutoriel (en anglais)
http://tronixstuff.com/2014/02/03/tutor ... color-lcd/
tiptopboards - admin
Avatar de l’utilisateur
tiptop
Administrateur du site
 
Messages: 88
Inscription: Mar 13 Aoû 2013 20:38
Localisation: 38

Retourner vers Capteurs et composants

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité