Hallo Leute!
Bei mir funktioniert das Einbinden einer Bitmap mit meinem Mega 2560 und meinem 3,2 Zoll großem Display von Sain Smart einfach nicht.
Das Beispiel-Programm von UTFT_bitmap funktioniert komischer weise. Nur wenn ich selbst bei rinky-dink Electronics ein jpg Bild berechnen lasse und es dann einfüge wie im untenstehenden Code gezeigt kommt immer die untenstehende Fehlermeldung.
Ich verwende Arduino 1.6
// UTouch_ButtonTest
// Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
// web: http://www.RinkyDinkElectronics.com/
//
// This program is a quick demo of how create and use buttons.
//
// This program requires the UTFT library.
//
// It is assumed that the display module is connected to an
// appropriate shield or that you know how to change the pin
// numbers in the setup.
//
#include <UTFT.h>
#include <UTouch.h>
#include <avr/pgmspace.h>
// Initialize display
// ------------------
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino Uno/2009 Shield : <display model>,19,18,17,16
// Standard Arduino Mega/Due shield : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Due : <display model>,25,26,27,28
// Teensy 3.x TFT Test Board : <display model>,23,22, 3, 4
// ElecHouse TFT LCD/SD Shield for Arduino Due : <display model>,22,23,31,33
//
// Remember to change the model parameter to suit your display module!
UTFT myGLCD(ITDB32S,38,39,40,41);
// Initialize touchscreen
// ----------------------
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino Uno/2009 Shield : 15,10,14, 9, 8
// Standard Arduino Mega/Due shield : 6, 5, 4, 3, 2
// CTE TFT LCD/SD Shield for Arduino Due : 6, 5, 4, 3, 2
// Teensy 3.x TFT Test Board : 26,31,27,28,29
// ElecHouse TFT LCD/SD Shield for Arduino Due : 25,26,27,29,30
//
UTouch myTouch( 6, 5, 4, 3, 2);
extern const unsigned int Tulips[1900];
// Declare which fonts we will be using
extern uint8_t BigFont[];
//const unsigned short Bild1[];
int x, y;
char stCurrent[20]="";
int stCurrentLen=0;
char stLast[20]="";
/*************************
** Custom functions **
*************************/
void drawMainmenu()
{
// Draw the 2 Buttons and the Standname
myGLCD.setColor(0, 0, 255);
myGLCD.fillRoundRect (10, 80, 150,140);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (10, 80, 150, 140);
myGLCD.setColor(0,0,255);
myGLCD.fillRoundRect (10, 150, 150,210);
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (10, 150, 150, 210);
myGLCD.drawBitmap (32, 32, 50, 38, Tulips);
myGLCD.print("Überschrift",10,10);
myGLCD.print("Name 1",15,100);
myGLCD.print("Name 2",15,170);
myGLCD.setBackColor (0, 0, 0);
}
// Draw a red frame while a button is touched
void waitForIt(int x1, int y1, int x2, int y2)
{
myGLCD.setColor(255, 0, 0);
myGLCD.drawRoundRect (x1, y1, x2, y2);
while (myTouch.dataAvailable())
myTouch.read();
myGLCD.setColor(255, 255, 255);
myGLCD.drawRoundRect (x1, y1, x2, y2);
}
/*************************
** Required functions **
*************************/
void setup()
{
// Initial setup
myGLCD.InitLCD();
myGLCD.clrScr();
myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
myGLCD.setFont(BigFont);
myGLCD.setBackColor(0, 0, 255);
drawMainmenu();
//drawButtons();
}
void loop()
{
while (true)
{
if (myTouch.dataAvailable())
{
myTouch.read();
x=myTouch.getX();
Serial.println(x);
y=myTouch.getY();
Serial.println(y);
if ((y>=80) && (y<=140))
{
if ((x>=10) && (x<=150))
{
waitForIt(10, 80, 150, 140);
myGLCD.print("Stoecke",40,220);
//updateStr('1');
}
}
if ((y>=150) && (y<=210))
{
if ((x>=10) && (x<=150))
{
waitForIt(10, 150, 150, 210);
myGLCD.print("Stand",40,220);
//updateStr('6');
}
}
}
}//while(true)
}//void loop()
main_display_1.1.ino: In function 'void drawMainmenu()':
main_display_1.1:74: error: invalid conversion from 'const unsigned int*' to 'unsigned int*' [-fpermissive]
In file included from main_display_1.1.ino:14:0:
C:\Users\St234\Documents\Arduino\libraries\UTFT/UTFT.h:223:8: error: initializing argument 5 of 'void UTFT::drawBitmap(int, int, int, int, unsigned int*, int)' [-fpermissive]
void drawBitmap(int x, int y, int sx, int sy, bitmapdatatype data, int scale=1);
^
invalid conversion from 'const unsigned int*' to 'unsigned int*' [-fpermissive]