Post Reply 
The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
10-08-2023, 06:28 AM
Post: #21
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
(10-07-2023 05:19 PM)matalog Wrote:  I got some of these on ebay; I found them a good short cable https://www.ebay.co.uk/itm/124463761770?...media=COPY.

I hope you can see it.

Merci beaucoup.

thank you very much

Sorry for my english
Find all posts by this user
Quote this message in a reply
10-11-2023, 05:56 PM (This post was last modified: 10-11-2023 05:58 PM by Tyann.)
Post: #22
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Bonsoir

J'ai reçu mon câble aujourd'hui un cable avec une prise rouge et une prise noire.
Je dois connecter la noire sur l'arduino et la rouge sur La Prime sinon la carte ne s'allume pas.
J'ai ensuite exécuté 'USBOPEN' pour recevoir les identifiants mais j'obtiens {}. Sad
J'utilise le Keyestudio 0248 (le même que vous je crois).
Une idée ?

Good evening

I received my cable today, a cable with a red plug and a black plug.
I have to connect the black one to the arduino and the red one to La Prime otherwise the card won't turn on.
I then ran 'USBOPEN' to get the credentials but I get {}. Sad
I'm using Keyestudio 0248 (the same as you I think).
Any ideas?

Sorry for my english
Find all posts by this user
Quote this message in a reply
10-12-2023, 01:32 AM
Post: #23
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
At this stage you have to be running the Arduino HID software on the Leonardo or it will not be acting as a HID device for the HP Prime to see.
Find all posts by this user
Quote this message in a reply
10-12-2023, 05:10 AM
Post: #24
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Bonjour Matalog

Tout d'abord merci pour vos réponses.
Je suis désolé, mais complétement novice en la matière;
comment je fais cela si ce n'est pas trop abuser ?


Hello Matalog

First of all, thank you for your answers.
I'm sorry, but I'm completely new to this;
How do I do this, if it's not too much trouble?

Sorry for my english
Find all posts by this user
Quote this message in a reply
10-12-2023, 10:01 AM
Post: #25
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Hi I won't be at my computer until later, to get you statted, you should be able to USBOpen your Arduino if you use the Arduino software im this thread, thatbis a beeper for HP Prime I made using Arduino. https://www.hpmuseum.org/forum/thread-20004.html
Find all posts by this user
Quote this message in a reply
10-13-2023, 05:01 PM (This post was last modified: 10-13-2023 05:44 PM by matalog.)
Post: #26
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
You should install this on your Arduino: https://www.arduino.cc/reference/en/libr...d-project/ - I used the RawHID example to start with.

It will complie with the Arduino IDE software, available from this site: https://www.arduino.cc/en/software

You should familiarise yourself with sending some example programs to the Arduino first, link Blink, so that you can verify it works and you can upload to it. Then compile the HID software linked above, and you will be able to connect with your HP Prime. You have to write software on both ends to enable communication the way you need it.
Find all posts by this user
Quote this message in a reply
10-14-2023, 05:34 AM
Post: #27
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Bonjour

Merci pour toutes ces précisions, j'ai installé le logiciel 'arduino-ide_2_2.1' sur mon PC.
Je vais maintenant suivre quelques tutoriels de programmation sur le 'leonardo'.
Puis je prendrai vos réalisations en exemple, mais le chemin peut être long .
Merci encore.


Hello

Thank you for all these details. I have installed the 'arduino-ide_2_2.1' software on my PC.
I'm now going to follow some programming tutorials on the 'leonardo'.
Then I'll use your work as an example, but it could be a long way off.
Thanks again.

Sorry for my english
Find all posts by this user
Quote this message in a reply
10-14-2023, 06:45 AM
Post: #28
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
I think with the RawHID example you are very close to sending and receiving bytes already.
Find all posts by this user
Quote this message in a reply
11-15-2023, 08:41 PM
Post: #29
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Bonjour

J'ai donc suivi plusieurs tutoriels et connecté plusieurs objets sur mon arduino, diodes, boutons poussoirs, écran, clavier, capteurs et écrit de petits programmes pour les exploiter et j’adore ça.
Ce soir j'ai connecté ma Prime à l’arduino et j'ai reçu de celui-ci quelques valeurs et une chaîne de caractères.
Cela me rends heureux, merci encore à matalog pour ses vidéos.
Je n arrive pas à trouver un descriptif des fonctionnalités de la bibliothèque RawHid ?
Merci à qui pourra m'aider.

Hello

So I followed several tutorials and connected several objects to my arduino, diodes, push buttons, screen, keyboard, sensors and wrote small programs to operate them and I love it.
Tonight I connected my Prime to the arduino and received some values and a string from it.
That makes me happy, thanks again to matalog for the videos.
I can't find a description of the RawHid library functionalities?
Thanks to anyone who can help me.

Translated with http://www.DeepL.com/Translator (free version)

Sorry for my english
Find all posts by this user
Quote this message in a reply
11-16-2023, 10:27 AM
Post: #30
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
(11-15-2023 08:41 PM)Tyann Wrote:  Bonjour

J'ai donc suivi plusieurs tutoriels et connecté plusieurs objets sur mon arduino, diodes, boutons poussoirs, écran, clavier, capteurs et écrit de petits programmes pour les exploiter et j’adore ça.
Ce soir j'ai connecté ma Prime à l’arduino et j'ai reçu de celui-ci quelques valeurs et une chaîne de caractères.
Cela me rends heureux, merci encore à matalog pour ses vidéos.
Je n arrive pas à trouver un descriptif des fonctionnalités de la bibliothèque RawHid ?
Merci à qui pourra m'aider.

Hello

So I followed several tutorials and connected several objects to my arduino, diodes, push buttons, screen, keyboard, sensors and wrote small programs to operate them and I love it.
Tonight I connected my Prime to the arduino and received some values and a string from it.
That makes me happy, thanks again to matalog for the videos.
I can't find a description of the RawHid library functionalities?
Thanks to anyone who can help me.

Translated with http://www.DeepL.com/Translator (free version)

I'm glad to hear that you are making progress with this.

I basically used the HID Project https://www.arduino.cc/reference/en/libr...d-project/ for Arduino. The RAW-HID example on the Arduino end will allow communication between the devices. You just have to let the Prime know when to send or receive data.

This is the code of the RAW HID for Arduino:

Code:
/*
  Copyright (c) 2014-2015 NicoHood
  See the readme for credit to other people.

  Advanced RawHID example

  Shows how to send bytes via RawHID.
  Press a button to send some example values.

  Every received data is mirrored to the host via Serial.

  See HID Project documentation for more information.
  https://github.com/NicoHood/HID/wiki/RawHID-API
*/

#include "HID-Project.h"

const int pinLed = LED_BUILTIN;
const int pinButton = 2;

// Buffer to hold RawHID data.
// If host tries to send more data than this,
// it will respond with an error.
// If the data is not read until the host sends the next data
// it will also respond with an error and the data will be lost.
uint8_t rawhidData[255];

void setup() {
  pinMode(pinLed, OUTPUT);
  pinMode(pinButton, INPUT_PULLUP);

  Serial.begin(115200);

  // Set the RawHID OUT report array.
  // Feature reports are also (parallel) possible, see the other example for this.
  RawHID.begin(rawhidData, sizeof(rawhidData));
}

void loop() {
  // Send data to the host
  if (!digitalRead(pinButton)) {
    digitalWrite(pinLed, HIGH);

    // Create buffer with numbers and send it
    uint8_t megabuff[100];
    for (uint8_t i = 0; i < sizeof(megabuff); i++) {
      megabuff[i] = i;
    }
    RawHID.write(megabuff, sizeof(megabuff));

    // Simple debounce
    delay(300);
    digitalWrite(pinLed, LOW);
  }


  // Check if there is new data from the RawHID device
  auto bytesAvailable = RawHID.available();
  if (bytesAvailable)
  {
    digitalWrite(pinLed, HIGH);

    // Mirror data via Serial
    while (bytesAvailable--) {
      Serial.println(RawHID.read());
    }

    digitalWrite(pinLed, LOW);
  }
}

Have a look at the code I shared for the BEEPER too : https://www.hpmuseum.org/forum/thread-20004.html

I hope this helps. Let me know if you need anything else.
Find all posts by this user
Quote this message in a reply
11-16-2023, 07:07 PM
Post: #31
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Bonsoir matalog

Je me suis inspiré bien évidement de vôtre projet BEEPER, j'ai réussi à envoyer comme je le mentionnais dans mon précédent post des valeurs depuis l'Arduino vers la Prime.
Et ce soir j'ai allumé une diode depuis l'arduino suite à l'envoi d'une valeur depuis la Prime.
Je me demande notamment comment fonctionne RawHID.available(), car je crois qu'il a un rôle intéressant dans la communication.

Good evening matalog

I was obviously inspired by your BEEPER project, I managed to send values from the Arduino to the Prime as I mentioned in my previous post.
And this evening I lit a diode from the arduino after sending a value from the Prime.
I wonder how RawHID.available() works, because I think it has an interesting role in communication.

Sorry for my english
Find all posts by this user
Quote this message in a reply
11-17-2023, 09:36 AM
Post: #32
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
(11-16-2023 07:07 PM)Tyann Wrote:  And this evening I lit a diode from the arduino after sending a value from the Prime.
I wonder how RawHID.available() works, because I think it has an interesting role in communication.

Great, then you will be able to do anything you want with the combination of the two devices next.

The only other information I can offer on RawHID.available() and the communication method used by RawHID is to have a look in the HID folder, HID_Project-2.8.4/src/singlereport/rawHID.h & rawHID.cpp.

Let me know if you find anything interesting about it, maybe we can streamline the code used to communicate over USB HID.
Find all posts by this user
Quote this message in a reply
11-18-2023, 07:48 AM
Post: #33
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Bonjour

Aujourd'hui j'ai réussi à envoyer une chaîne de caractères depuis la Prime vers l'Arduino
et afficher celle-ci sur un écran LCD.
Cela n'a pas été sans mal, mais j'ai appris pas mal de choses, notamment qu'il faut lire 64 valeurs
avec RawHID.read() quel que soit le nombre de valeurs que l'on envoie.
Côté Prime j'ai envoyé une liste avec une valeur de référence, la taille de la chaîne puis les codes ASCII des caractères.
J'ai utilisé RawHID.alavaible() pour entrer dans la comm, puis ma valeur de référence pour la boucle de lecture et la taille de la chaîne pour l'affectation des caractères et le 0 de fin de chaîne.

Je peux donc maintenant offrir à ma caltos un clavier et un écran secondaires.
Vraiment cool.

Hello

Today I managed to send a character string from the Prime to the Arduino
and display it on an LCD screen.
It wasn't easy, but I learnt quite a few things, including that you have to read 64 values
with RawHID.read() regardless of the number of values sent.
On the Prime side, I sent a list with a reference value, the size of the string and then the ASCII codes of the characters.
I used RawHID.alavaible() to enter the comm, then my reference value for the read loop and the size of the string to assign the characters and the 0 at the end of the string.

So now I can give my caltos a secondary keyboard and screen.
Really cool.

Sorry for my english
Find all posts by this user
Quote this message in a reply
11-19-2023, 08:22 AM
Post: #34
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Bonjour

J'ai voulu essayer de limiter le nombre de données envoyées depuis l'Arduino
avec le second argument de RawHID.write(), mais je reçois quand même 64 valeurs.
Du coup je ne comprends pas à quoi sert ce second argument ?

Voici mon code :

Hello

I tried to limit the amount of data sent from the Arduino
with the second argument to RawHID.write(), but I still receive 64 values.
So I don't understand what the second argument is for?

Here's my code:
Code:

void loop() {
  // put your main code here, to run repeatedly:
    for (int i=0; i<6; i++){
       k[i]=i*2;
    }
    auto com=RawHID.available();
    if (com)
    {
     j=RawHID.read();
      if (j==255) {
   
        RawHID.write(k,6);
      }
    j=0; 
    }
}

Sorry for my english
Find all posts by this user
Quote this message in a reply
11-20-2023, 12:22 PM
Post: #35
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Yes, I think HID itself, at least for USB 2.0, sends packets of 64 bytes - You should always receive all of them and if you want to, you can hide that you received more than you need.

There was something about the RAWHID() I remember, I had to limit sending bytes to 63 bytes from the Arduino at a time, because if I sent 64 it actually sent 2 HID messages instead of one, leaving bytes hard to keep track of. I wasn't sure why the Arduino did that.
Find all posts by this user
Quote this message in a reply
11-20-2023, 03:38 PM
Post: #36
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Bonjour matalog

Oui, c'est que j'ai cru comprendre aussi.
Merci encore pour toute l'aide.
Encore une question si vous permettez, je suis très intéressé par l'utilisation d'un lecteur
de codes barres et je vois que celui-ci sur vôtre vidéo est connecté en USB aussi.
Il y a donc une petite interface entre lui et l'arduino, est-ce un Uno ?

Hello matalog

Yes, that's what I thought too.
Thanks again for all the help.
One more question if you don't mind, I'm very interested in using a barcode reader and I see that this one on your video is connected to USB too.

So there's a small interface between it and the arduino, is it a Uno?

Sorry for my english
Find all posts by this user
Quote this message in a reply
11-20-2023, 04:49 PM
Post: #37
RE: The ultimate partner for the HP Prime G2 - The Arduino Leonardo.
Yes, that is a very handy little board made by HobbyTronics https://www.hobbytronics.co.uk/product/host-board

I use it in Keyboard mode. Then those barcode readers all have a Keyboard output mode.
Find all posts by this user
Quote this message in a reply
Post Reply 




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