Go Down

Topic: SerialImageDisplay (Read 1 time) previous topic - next topic

WakaDArc

Hello,

I am getting this error
SerialImageDisplayers:18: error: 'UTFT' does not name a type
SerialImageDisplayers.ino: In function 'void ShowInfo()':
SerialImageDisplayers:28: error: 'myGLCD' was not declared in this scope
SerialImageDisplayers:33: error: 'CENTER' was not declared in this scope
SerialImageDisplayers.ino: In function 'void setup()':
SerialImageDisplayers:43: error: 'myGLCD' was not declared in this scope
SerialImageDisplayers.ino: In function 'void loop()':
SerialImageDisplayers:98: error: 'myGLCD' was not declared in this scope

when I run this sketch
Code: [Select]
// SerialImageDisplay
// Written by Stanley Huang <stanleyhuangyc@gmail.com>
//
// This program requires the UTFT library.
//

#include <UTFT.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];

//File myFile;

// for Arduino Leonardo
//UTFT myGLCD(ITDB28,A5,A4,A3,A2);   // Remember to change the model parameter to suit your display module!

// for Arduino 2009/Uno
UTFT myGLCD(ITDB28,19,18,17,16);   // Remember to change the model parameter to suit your display module!

// for Arduino Mega
//UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!

#define SYNC_FRAME_START 'S'
#define SYNC_FRAME_ACK 'A'

void ShowInfo()
{
    myGLCD.setColor(255, 0, 0);
    myGLCD.fillRoundRect(65, 100, 255, 150);

    myGLCD.setColor(255, 255, 255);
    myGLCD.setBackColor(255, 0, 0);
    myGLCD.print("MediaCoder", CENTER, 106);
    myGLCD.print("Arduino Frame Display", CENTER, 119);
    myGLCD.print("Waiting for connection", CENTER, 132);
}

void setup()
{
    Serial.begin(115200);

    // Setup the LCD
    myGLCD.InitLCD();
    myGLCD.setFont(SmallFont);
    myGLCD.fillScr(0, 0, 255);
    ShowInfo();
}

int SerialRead()
{
    unsigned long t = millis();
    while (!Serial.available()) {
        if (millis() - t > 10000)
            return -1;
    }
    return Serial.read();
}

uint16_t SerialReadInt()
{
    byte d[2] = {SerialRead(), SerialRead()};
    return *(uint16_t*)d;
}

void loop()
{
    // wait serial data
    while (!Serial.available());
    // check sync byte
    if (Serial.read() == SYNC_FRAME_START) {
        Serial.write(SYNC_FRAME_ACK);

        // get frame left/top/width/height
        uint16_t sx = SerialReadInt();
        uint16_t sy = SerialReadInt();
        uint16_t w = SerialReadInt();
        uint16_t h = SerialReadInt();

        if (w == 0xffff || h == 0xffff) {
            // timeout
            ShowInfo();
            return;
        }
        Serial.write(SYNC_FRAME_ACK);

        uint16_t pixels[320];
        for (int y = 0; y < h; y++) {
            for (int x = w - 1; x >= 0; x--) {
                int c1;
                int c2;
                if ((c1 = SerialRead()) == -1 || (c2 = SerialRead()) == -1) {
                    // timeout
                    ShowInfo();
                    return;
                }
                pixels[x] = (uint16_t)c2 << 8 | (byte)c1;
            }
            myGLCD.drawPixelLine(sx, sy + y, w, pixels);
            Serial.write(SYNC_FRAME_ACK);
        }
    }
}


This is my equipment
http://www.arduinodev.com/hardware/obd-kit-2/   (Iteaduino Uno)
http://www.arduinodev.com/hardware/arduino-tft-shield/    (2.8"TFT screen)
https://github.com/stanleyhuangyc/ArduinoTFT/tree/master/SDImageViewer   (WHERE I downloaded the sketch/libraries)

Any ideas?
Thank you

UKHeliBob

Which folder did you install the UTFT to ?
It should be in the libraries folder of the folder where you programs are saved.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

WakaDArc

Yes I have it in the libraries folder which is with all my sketches (all under my documents/Arduino).

okay I changed it to
#include "UTFT.h" instead of using "<" and ">"

and now I get a different error..

UTFT\DefaultFonts.c.o:(.progmem.data+0x0): multiple definition of `SmallFont'
DefaultFonts.c.o:(.progmem.data+0x0): first defined here
UTFT\DefaultFonts.c.o:(.progmem.data+0x478): multiple definition of `BigFont'
DefaultFonts.c.o:(.progmem.data+0x478): first defined here
UTFT\DefaultFonts.c.o:(.progmem.data+0x105c): multiple definition of `SevenSegNumFont'
DefaultFonts.c.o:(.progmem.data+0x105c): first defined here
UTFT\UTFT.cpp.o: In function `UTFT::_hw_special_init()':
/hardware/avr/HW_ATmega328P.h:4: multiple definition of `UTFT::_hw_special_init()'
UTFT.cpp.o:/HW_ATmega328P.h:4: first defined here
UTFT\UTFT.cpp.o: In function `UTFT::LCD_Writ_Bus(char, char, unsigned char)':
/hardware/avr/HW_ATmega328P.h:6: multiple definition of `UTFT::LCD_Writ_Bus(char, char, unsigned char)'
UTFT.cpp.o:/HW_ATmega328P.h:6: first defined here
UTFT\UTFT.cpp.o: In function `UTFT::_set_direction_registers(unsigned char)':
/hardware/avr/HW_ATmega328P.h:95: multiple definition of `UTFT::_set_direction_registers(unsigned char)'
UTFT.cpp.o:/HW_ATmega328P.h:95: first defined here
UTFT\UTFT.cpp.o: In function `UTFT::_fast_fill_16(int, int, long)':
/hardware/avr/HW_ATmega328P.h:104: multiple definition of `UTFT::_fast_fill_16(int, int, long)'
UTFT.cpp.o:/HW_ATmega328P.h:104: first defined here
UTFT\UTFT.cpp.o: In function `UTFT::_fast_fill_8(int, long)':



(error was bigger but couldnt fit)

Docedison

I had that error once and the cure was to properly install the lib in the My Documents\Arduino\libraries folder and the sketches in My Documents\Arduino folder
I was trying to compile the demo file in the directory I use for downloads and it didn't work until I installed them correctly. The errors about duplicate references... was the giveaway.

Doc
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

WakaDArc

Yeah, that was what I was thinking too but I already installed it properly..here are some pics.

MY ARDUINO FOLDER



MY SKETCH FOLDER



MY LIBRARY FOLDER



MY UTFT FOLDER

WakaDArc

Sorry the last two pics got cut off. Pretty much there is the UTFT library and in there the UTFT.h


Go Up