Post Reply 
Hp prime chat terminal using arduino
07-04-2024, 09:49 PM
Post: #2
RE: Hp prime chat terminal using arduino
1) Your 'TEXTOUT_P' probably fails, missing an argument.
2) You also might want to use 'G0' to see the output (vs G1~G9 that are buffers in memory and not the actual screen).
3) You probably will need to open the connection by USBOpen(Vid,Pid).

I also recommend to test that USBRecv() returns a list and not just '0'.
See encl. changes..

Code:

// 2024.0704 pretty-prime v0.3b
#pragma mode(separator(.,;) integer(h32))
EXPORT USBHIDCommunication()
BEGIN 
LOCAL send_data:={1,2,3,4,5};               // Example data to send
LOCAL received_data;

  // Initialize graphic buffers
  // DIMGROB_P(G1, 320, 240);
  // RECT_P(G1, 0, 0, 320, 240, RGB(255, 255, 255));

  // Open USB HID connection
  USBOpen();
  // USBOpen(YourVid, YourPid);

  // Main communication loop
  REPEAT 
    // Send data
    USBSend(send_data);

    // Receive data
    received_data:=USBRecv();

    // Display received data
    // IF SIZE(received_data) > 0 THEN
    IF (SIZE(received_data)>0) AND (TYPE(received_data)=6) THEN 
      // RECT_P(G1, 0, 0, 320, 240, RGB(255, 255, 255)); // Clear screen
      RECT_P();                             // Clear screen G0 by default

      // TEXTOUT_P("Received: " + STRING(received_data), 10, 10, 1, RGB(0, 0, 0), RGB(255, 255, 255));
      TEXTOUT_P("Received: "+STRING(received_data),10,10,1,RGB(0,0,0),200,RGB(255,255,255));
      WAIT(1);
    END;

  UNTIL ISKEYDOWN(4);                       // Exit on pressing a key

END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Hp prime chat terminal using arduino - gehakte_bits - 07-04-2024 09:49 PM



User(s) browsing this thread: 1 Guest(s)