19.- First electronic tests: keypad + tft

Aquesta entrada és una mica xorra però forma part del procés que he anat seguint. El penjo per si algú vol fer-ser el taulell li sigui més fàcil trobar la informació.

Esta entrada es un poco chorra pero forma parte del proceso que he ido siguiendo. El cuelgo por si alguien quiere hacerlo fue el mostrador le sea más fácil encontrar la información.

This post is a bit silly but it’s part of the process I’ve been following. Hang it up in case anyone wants to make the counter easier for you to find the information.



#include <Keypad.h>

#include <SPI.h>
#include <Wire.h>
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);


const byte rowsCount = 4;
const byte columsCount = 4;

char keys[rowsCount][columsCount] = {
{ '1','2','3', 'A' },
{ '4','5','6', 'B' },
{ '7','8','9', 'C' },
{ '#','0','*', 'D' }
};

const byte rowPins[rowsCount] = { 11, 10, 9, 8 };
const byte columnPins[columsCount] = { 7, 6, 5, 4 };

Keypad keypad = Keypad(makeKeymap(keys), rowPins, columnPins, rowsCount, columsCount);

void setup() {

Serial.begin(9600);
Serial.println("ILI9341 Test!");
tft.begin();}

void loop() {
char key = keypad.getKey();

switch(key)
{
case '1':
tft.clearDisplay();
tft.println("c2c4");
tft.display();
delay(250);
break;
case '2':
tft.println("f2f3");
tft.display();
delay(250);

break;
case '4':
tft.println("g1f3");
tft.display();
delay(250);
break;
}
}


Comentaris

Entrades populars d'aquest blog

45.- Weighting the pieces

3.- Sensors II

21.- Electronic scheme (updated 26/08/2020)