Serial Communication for pi game

Hello, I am new to programming and I have been working on a game that involves several arduinos that communicate to each other via a HC12 433hrz module. I now want to attach one of these modules to a raspberry pi and build a user interface for the game in Xojo. I have been watching a bunch of tutorials including the one on making a Serial port dropdown menu which was very helpful but I still need a bit of assistance as I am getting error messages with anything that I write.

Ok so I found a serial controller that I named thisSerial and I figured some code would go in there like a DataAvailable event handler etc. What I am attempting to achieve is to…

  1. first off select the serial port (already accomplished by the tutorial).
  2. Set the baud rate perminataly to 9600
  3. Look for any data in the serial buffer and read it.
    –prabably use MsgBox to display this so I can check the data is an integer between 1 and 63
  4. Save that data in a variable called ID (this should be an integer between 1 and 63)

I have two Canvas drawn on my window. This will be score counters for a player one and a player 2 and depending on what number ID is will determine what canvas is updated. So I need each canvas to display 0 to begin with…

  1. and then
    a) if ID is between 1-5 add 1 to (player 1 Score canvas)
    b) if ID is between 6 -10 add 1 to (player 2 score canvas)

That is essentially it so any help with this would be greatly appreciated. I want to add more features later like a

  • reset button to reset the scores.
  • A save button that will save the players score to a score board that can later be saved to a document
  • an ability to add more players an assign them to ID numbers etc

Ok thanks!

Hi Korrin,

While your question isn’t really RPi specific, the concept from what I read is that you want to use serial comms (to an Arduino in this case) to exchange data with a Xojo app, running on RPi.

There are a billion entries in the forum that talk about serial port comms - and there are great sample projects that came with the Xojo app (look for Example Projects > Communication > Serial, in the Xojo folder).

I’m not always the fastest responder on the forum, but I’ll do my best to help you out.

Check out the Serial examples and post where you get stuck.

Hoping to help.

Ok thanks ill dig a little deeper. I am getting my head around xojo and this type of coding so my app is coming along and last will be the serial communication so ill see what I find and if I get stuck again on anything specific ill ask about that. Thanks