# data[].attributes.body
#include <LiquidCrystal.h>
#include <Keypad.h> /

const byte numLinhas= 4;
const byte numColunas= 3;

char mapaTeclado[numLinhas][numColunas]=
{
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};

byte pinosLinhas[numLinhas] = { 0, 1, 2, 3 };
byte pinosColunas[numColunas]=  { 4, 5, 6 };

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);

long Num1,Num2,Number;
char key,action;
boolean result = false;

void setup() {
lcd.begin(16, 2);
lcd.print(""Padlet"");
lcd.setCursor(0, 1);
lcd.print("Calculadora");

delay(2000);
lcd.clear();
}

void loop() {

key = kpd.getKey();

if (key!=NO_KEY)
DetectButtons();

if (result==true)
CalculateResult();

DisplayResult();
}

void DetectButtons()
{
lcd.clear();
if (key=='*') /
{Serial.println ("Button Cancel"); Number=Num1=Num2=0; result=false;}

if (key == '1')
{Serial.println ("Button 1");
if (Number==0)
Number=1;
else
Number = (Number*10) + 1;
}

if (key == '4')
{Serial.println ("Button 4");
if (Number==0)
Number=4;
else
Number = (Number*10) + 4;
}

if (key == '7')
{Serial.println ("Button 7");
if (Number==0)
Number=7;
else
Number = (Number*10) + 7;
}

if (key == '0')
{Serial.println ("Button 0");
if (Number==0)
Number=0;
else
Number = (Number*10) + 0;
}

if (key == '2')
{Serial.println ("Button 2");
if (Number==0)
Number=2;
else
Number = (Number*10) + 2;
}

if (key == '5')
{Serial.println ("Button 5");
if (Number==0)
Number=5;
else
Number = (Number*10) + 5;
}

if (key == '8')
{Serial.println ("Button 8");
if (Number==0)
Number=8;
else
Number = (Number*10) + 8;
}

if (key == '##')
{Serial.println ("Button Equal");
Num2=Number;
result = true;

}

if (key == '3')
{Serial.println ("Button 3");
if (Number==0)
Number=3;
else
Number = (Number*10) + 3;
}

if (key == '6')
{Serial.println ("Button 6");
if (Number==0)
Number=6;
else
Number = (Number*10) + 6;
}

if (key == '9')
{Serial.println ("Button 9");
if (Number==0)
Number=9;
else
Number = (Number*10) + 9;
}

if (key == '#' || key == '*')
{
Num1 = Number;
Number =0;
if (key == '#')
{Serial.println ("Addition"); action = '+';}
if (key == '*')
{Serial.println ("Multiplication"); action = '*';}
delay(100);
}

}

void CalculateResult()
{
if (action=='+')
Number = Num1+Num2;

if (action=='*')
Number = Num1*Num2;
}

void DisplayResult()
{
lcd.setCursor(0, 0);
lcd.print(Num1); lcd.print(action); lcd.print(Num2);

if (result==true)
{lcd.print(" ="); lcd.print(Number);}

lcd.setCursor(0, 1);
lcd.print(Number);
}

# data[].attributes.body
int pos = 0;

void setup()
{
pinMode(2, INPUT);
pinMode(8, OUTPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(9, INPUT);
}

void loop()
{
// if button press on 2 is detected
if (digitalRead(2) == HIGH) {
tone(8, 261, 100);
}
if (digitalRead(3) == HIGH) {
tone(8, 294, 100);
}
if (digitalRead(4) == HIGH) {
tone(8, 329, 100);
}
if (digitalRead(5) == HIGH) {
tone(8, 349, 100);
}
if (digitalRead(6) == HIGH) {
tone(8, 392, 100);
}
if (digitalRead(7) == HIGH) {
tone(8, 440, 100);
}
if (digitalRead(9) == HIGH) {
tone(8, 493, 100);
}
delay(10);
}

# data[].attributes.attachment_link.description
Veja todas as coisas maravilhosas que anapaulamorim0603 fez