Andrea Fionda
Published © CC BY

Covid-19 rules in six languages

Arduino Mega that sends three different rules to the TFT display for the language chosen by the user. There are six languages available: Ita

IntermediateFull instructions provided6 hours314
Covid-19 rules in six languages

Things used in this project

Hardware components

Arduino Mega 2560
Arduino Mega 2560
×1
Nextion NX3224T028 - Generic 2.8" HMI LCD Touch Display
Itead Nextion NX3224T028 - Generic 2.8" HMI LCD Touch Display
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Code

Covid-19 rules

Arduino
This is the code of my project to know the Covid-19 rules.
#include <Adafruit_GFX.h>   
#include <MCUFRIEND_kbv.h>  
#include <UTFTGLUE.h> 
#include <TouchScreen.h>
UTFTGLUE myGLCD(0,A2,A1,A3,A4,A0);
MCUFRIEND_kbv tft;
#define BLACK   0x0000
#define RED     0xF800
#define GREEN   0x0z7E0
#define WHITE   0xFFFF
#define GREY    0x8410

#define TS_MINX 204
#define TS_MINY 195
#define TS_MAXX 948
#define TS_MAXY 910

#define YP A2  // must be an analog pin, use "An" notation!
#define XM A3  // must be an analog pin, use "An" notation!
#define YM 8   // can be a digital pin
#define XP 9   // can be a digital pin

#include <Fonts/FreeSans12pt7b.h>
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
int stc=0;

void setup(void)
{
    tft.setTextColor(RED, GREY);
    myGLCD.InitLCD();
    myGLCD.setFont(SmallFont);
    Serial.begin(9600);
    uint16_t ID = tft.readID();
    if (ID == 0xD3) ID = 0x9481;
    tft.begin(ID);
    tft.setRotation(45);
    tft.fillScreen(BLACK);
    tft.setTextSize(1);
    tft.setFont(&FreeSans12pt7b);
    tft.setCursor(115, 68);
    tft.print("SELECT");
    tft.setCursor(85, 98);
    tft.print("A LANGUAGE");
    tft.setCursor(100, 168);
    tft.print("PRESS OK");
    tft.setCursor(260, 220);
    tft.print("OK");
}

void loop(void)
{
  TSPoint p = ts.getPoint();  //Get touch point
  
  if (p.z > ts.pressureThreshhold) {

   Serial.print("X = "); Serial.print(p.x);
   Serial.print("\tY = "); Serial.print(p.y);
   Serial.print("\n");}
   if(p.y>100 && p.y<300 && p.x>100 && p.x<300 )
   {
    stc=1;
   pinMode(XM, OUTPUT);
   pinMode(YP, OUTPUT);
  tft.fillScreen(BLACK);
  tft.setTextSize(1);
  tft.setFont(&FreeSans12pt7b);
  tft.setCursor(50,30);
  tft.print("ITALIANO");
  tft.setCursor(50,70);
  tft.print("ENGLISH");
  tft.setCursor(50,110);
  tft.print("FRANCAIS");
  tft.setCursor(50,150);
  tft.print("ESPANOL");
  tft.setCursor(50,190);
  tft.print("DEUTSCHE");
  tft.setCursor(50,230);
  tft.print("PORTUGUES");
  }
  if((stc==1)&&(p.y>783 && p.y<900 && p.x>350 && p.x<900))
   {   
        stc=0;
       pinMode(XM, OUTPUT);
   pinMode(YP, OUTPUT);
  tft.fillScreen(BLACK);
  tft.setTextSize(1);
  tft.setFont(&FreeSans12pt7b);
  tft.setCursor(65,30);
  tft.print("INDOSSARE LA");
  tft.setCursor(75,70);
  tft.print("MASCHERINA");
  tft.setCursor(65,110);
  tft.print("DISINFETTARSI");
  tft.setCursor(105,150);
  tft.print("LE MANI");
  tft.setCursor(60,190);
  tft.print("MANTENERE UN");
  tft.setCursor(35,230);
  tft.print("METRO DI DISTANZA");
  
}
if((stc==1)&&(p.y>666 && p.y<783 && p.x>350 && p.x<900))
  {
    stc=0;
       pinMode(XM, OUTPUT);
   pinMode(YP, OUTPUT);
  tft.fillScreen(BLACK);
  tft.setTextSize(1);      
  tft.setFont(&FreeSans12pt7b);
  tft.setCursor(95,30);
  tft.print("WEAR THE");
  tft.setCursor(125,70);
  tft.print("MASK");
  tft.setCursor(95,110);
  tft.print("DISINFECT");
  tft.setCursor(75,150);
  tft.print("YOUR HANDS");
  tft.setCursor(105,190);
  tft.print("KEEP A");
  tft.setCursor(75,230);
  tft.print("METER AWAY");
}
if((stc==1)&&(p.y>548 && p.y<666 && p.x>350 && p.x<900))
   {   
        stc=0;
       pinMode(XM, OUTPUT);
   pinMode(YP, OUTPUT);
  tft.fillScreen(BLACK);
  tft.setTextSize(1);       
  tft.setFont(&FreeSans12pt7b);
  tft.setCursor(90,30);
  tft.print("PORTER LE");
  tft.setCursor(105,70);
  tft.print("MASQUE");
  tft.setCursor(75,110);
  tft.print("DESINFECTEZ");
  tft.setCursor(90,150);
  tft.print("VOS MAINS");
  tft.setCursor(70,190);
  tft.print("MAINTENIR UN");
  tft.setCursor(35,230);
  tft.print("METRE DE DISTANCE");
}
if((stc==1)&&(p.y>432 && p.y<666 && p.x>350 && p.x<900))
   {  
        stc=0;
       pinMode(XM, OUTPUT);
   pinMode(YP, OUTPUT); 
  tft.fillScreen(BLACK);
  tft.setTextSize(1);       
  tft.setFont(&FreeSans12pt7b);
  tft.setCursor(110,30);
  tft.print("USAR LA");
  tft.setCursor(100,70);
  tft.print("MASCARA");
  tft.setCursor(80,110);
  tft.print("DESINFECTA");
  tft.setCursor(85,150);
  tft.print("TUS MANOS");
  tft.setCursor(10,190);
  tft.print("MANTENGA UN MEDIDOR");
  tft.setCursor(75,230);
  tft.print("DE DISTANCIA");
}
if((stc==1)&&(p.y>198 && p.y<315 && p.x>350 && p.x<900))
   {   
        stc=0;
       pinMode(XM, OUTPUT);
   pinMode(YP, OUTPUT);
  tft.fillScreen(BLACK);
  tft.setTextSize(1);       
  tft.setFont(&FreeSans12pt7b);
  tft.setCursor(115,30);
  tft.print("TRAGEN");
  tft.setCursor(75,70);
  tft.print("SIE DIE MASKE");
  tft.setCursor(35,110);
  tft.print("DESINFEKTIONIEREN");
  tft.setCursor(60,150);
  tft.print("SIE IHRE HANDE");
  tft.setCursor(50,190);
  tft.print("BEHALTEN SIE EIN");
  tft.setCursor(15,230);
  tft.print("METER DER ENTFERNUNG");
}
if((stc==1)&&(p.y>0 && p.y<198 && p.x>350 && p.x<900))
   { 
        stc=0;    
    pinMode(XM, OUTPUT);
   pinMode(YP, OUTPUT);
  tft.fillScreen(BLACK);
  tft.setTextSize(1);      
  tft.setFont(&FreeSans12pt7b);
  tft.setCursor(115,30);
  tft.print("USAR A");
  tft.setCursor(100,70);
  tft.print("MASCARA");
  tft.setCursor(70,110);
  tft.print("DESINFECTAR");
  tft.setCursor(105,150);
  tft.print("AS MAOS");
  tft.setCursor(15,190);
  tft.print("MANTENHA UN MEDIDOR");
  tft.setCursor(70,230);
  tft.print("DE DISTANCIA");
}
}

Credits

Andrea Fionda

Andrea Fionda

1 project • 1 follower

Comments