ELÉTRICA SIMULAÇÕES
Published © GPL3+

Digital MASK

A mask with a LCD display for people to talk and avoid take it off, because somebody take it off mask for speak something.

IntermediateProtip461
Digital MASK

Things used in this project

Hardware components

Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Arduino UNO
Arduino UNO
×1

Hand tools and fabrication machines

Tape, Double Sided
Tape, Double Sided
Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Custom parts and enclosures

Layout MASK

Schematics

Layout DIGITAL MASK

Code

code project digital mask

C/C++
// ========================================================================================================
// --- Bibliotecas Auxiliares ---
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>              //biblioteca LCD


// ========================================================================================================
// --- Objetos ---
LiquidCrystal_I2C lcd(0x27,20,4);   //ligaes Arduino - LCD


// ========================================================================================================
// --- Variveis Globais ---
void send_str(bool line_num);           //funo que envia strings do terminal para o LCD


// ========================================================================================================
// --- Variveis Globais ---
boolean line_n = 1;                     //armazena o nmero da linha do LCD


// ========================================================================================================
// --- Configuraes Iniciais ---
void setup()
{
   
  lcd.init();                     //lcd 16 colunas, 2 linhas
  lcd.backlight();
  Serial.begin(9600);               //inicia serial 115200 baud rate
  
  Serial.print("Aguardando entradas na serial...");  //imprime
   
} //end setup


// ========================================================================================================
// --- Loop Infinito ---
void loop()
{

   if(line_n) send_str(line_n);  //se line_n verdadeiro, envie string na linha 1
  
   else send_str(line_n);        //seno,  falso, envia string na linha 2

   
} //end loop


// ========================================================================================================
// --- Desenvolvimento das Funes ---
void send_str(bool line_num)
{
   
   //l todos os caracteres disponveis
   if (Serial.available()) 
   {
  
      //aguarda receber mensagem completa
      delay(100);

      //determina a linha do display
      if(line_num) { lcd.setCursor(0,0);  line_n = 0;  }
      else         { lcd.setCursor(0,1);  line_n = 1;  }
    
      //mostra os caracteres no LCD
      while (Serial.available() > 0)  lcd.write(Serial.read()); 

      //envia espaos para limpeza "manual" do LCD
      for(int i=0; i<15; i++) lcd.print(" ");
  
   } //end Serial available 
  
  
} //end send_str

Credits

ELÉTRICA SIMULAÇÕES

ELÉTRICA SIMULAÇÕES

4 projects • 2 followers
Electrical engineering studend, iot, c++, arduino, automation etc.

Comments