Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

Hallo.

Ich arbeite mich derzeit in die Verwendung von Tinkerforge-Modulen mit QtCreator ein. Gestartet bin ich mit dem LCD128x64. Dabei hänge ich an folgendem Problem fest:

Der folgende Code (main.cpp) schreibt nur dann auf das LCD128x64, wenn ich vor dem write-Befehl den destroy-Befehl absetze!

Woran könnte das liegen?

Herzlichen Dank für eure Hilfe

#include "startwindow.h"
#include <QApplication>

#include "ip_connection.h"
#include "bricklet_lcd_128x64.h"

#define HOST "localhost"
#define PORT 4223
#define UID "24Pm"



int main(int argc, char *argv[])
{
// Neu
    IPConnection ipcon;
    ipcon_create(&ipcon);

    // Create device object
    LCD128x64 lcd;
    lcd_128x64_create(&lcd, UID, &ipcon);

    // Connect to brickd
    if(ipcon_connect(&ipcon, HOST, PORT) < 0) {
        fprintf(stderr, "Could not connect\n");
        return 1;
    }
    // Don't use device before ipcon is connected

    // Clear display
    lcd_128x64_clear_display(&lcd);
 
      
    lcd_128x64_destroy(&lcd);
      
      
    // Write "Hello World" starting from upper left corner of the screen
    lcd_128x64_write_line(&lcd, 0, 0, "Hellllllllllo World");

    QApplication a(argc, argv);
    StartWindow w;
    w.show();
    return a.exec();
}

 

Geschrieben
  • Autor

Folgendes habe ich noch vergessen: Ich verwende einen iMac, mit QT 6.7.1. Der Brickviewer erkennt das LCD128x64 und kann auch schreiben.

Geschrieben

Mich wundert eher, dass das nicht crashed mit lcd_128x64_destroy vor lcd_128x64_write_line. Das das so herum funktioniert ist eher Zufall. Dreh das mal bitte wieder um.

lcd_128x64_write_line gibt einen int zurück. Gibt dir denn Wert mal bitte aus. 

Geschrieben
  • Autor

Ich habe lcd_128x64_destroy auskommentiert. Rückgabewert von lcd128x64_write = 0

Geschrieben
  • Autor

Lasse ich die destroy-funktion drin erhalte ich ebenfalls 0

Geschrieben
  • Autor

Also die Rückgabe-Werte der int-Funktionen (IPConnect, write und set_response) sind alle 0.

Auf wundersame Weise funktioniert es jetzt - ich hab´s mehrmals probiert.

Eine Ursache kann ich leider nicht erkennen.

Ich probiere jetzt mal verschiedene Bricklets aus und melde mich gegebenenfalls wieder.

erst mal vielen Dank 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.