/* TFT-Display einbinden */
#include <Adafruit_GFX.h> // include Adafruit graphics library
#include <Adafruit_ILI9341.h>
#define TFT_CS 15 // TFT CS pin is connected to arduino pin 8
#define TFT_RST 4 // TFT RST pin is connected to arduino pin 9
#define TFT_DC 2 // TFT DC pin is connected to arduino pin 10
// initialize ILI9341 TFT library
Adafruit_ILI9341 Tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
/* Funktionen nach Technischer Richtlinie einbinden */
void lcd_init(void)
{
Tft.begin();
}
void lcd_clear(void)
{
Tft.begin();
}
void lcd_setcursor(uint8_t row, uint8_t column)
{
Tft.setCursor(row,column);
}
void lcd_char(char data)
{
Tft.print(data);
}
void lcd_print(uint8_t text[])
{
char txt[171];
uint8_t i;
for(i=0;i<170;i++)
txt[i]=' ';
for(i=0;i<170;i++)
txt[i]=text[i];
txt[170]='\0';
Tft.print(txt);
}
void lcd_byte(uint8_t data)
{
char txt[5];
sprintf(txt,"%3d",data);
Tft.print(txt);
}
void lcd_int(uint16_t data)
{
char txt[10];
sprintf(txt,"%5d",data);
Tft.print(data);
}
/* ##### ##### Hauptprogramm ##### ##### */
uint8_t text[10] = "LCD Test";
void setup() {
lcd_init();
lcd_clear();
lcd_setcursor(1, 1);
lcd_print(text);
}
void loop() {
uint8_t text[10] = "Zahl: ";
uint16_t a = 0;
while(1) {
lcd_setcursor(1,10);
lcd_print(text);
lcd_byte(a++);
Serial.print()
delay(1000);
}
}