4D Systems GenieArduino Library

Has anyone tried to use the Spark with the 4D Systems GenieArduino library?
4D Systems

Although expensive, they are great touchscreen solutions and the Arduino Library is quite powerful.

@MagicTech, I have a library ported to the Spark but it is not the latest. I will get the latest, port to use Serial1 on the Spark and post on my repo so you can test and then to an IDE library. :smile:

3 Likes

Damn peekay, When do you sleep LOL.
Thanks so much. Yeah I downloaded the latest library yesterday and none of my old sketches work so it seems there are a lot of changes.
Much obliged to you Sir.

1 Like

Yup, they made some big but good changes that now support multiple-displays if you have multiple comm ports. I will include the (ported) examples so you can see what changed. :smile:

@MagicTech, the library is available on my repo here. Let me know how it goes! :smile:

Thanks a bunch, I will get to trying it this weekend. Whilst i have your attention, do you know if I2C slave is or will be available soon? As this Genie connection will take up the only Serial port, I have another device that I need to hand off information from to the Spark and my only alternate is I2C.
Thanks

Hi Peekay
So I want to try the libary now, but have not worked with Libraries on Spark build before. How do I get the library into the web IDE? I tied to click Contribute but since it is your repository I dont think it will allow me?
It says invalid license.
Sorry for the noob question.

Create rays with same file names then cut and paste from library. It is not an official IDE library yet.

Ok, By rays I guess you mean the tabs at the top of the sketch which opens up a .h and .cpp and replace them with the library files?
To try and run your example, did this use one of the 4d Workshop examples or does the Visi-Genie project have to be created?

Thanks

@MagicTech, LOL!!! Auto-correct on my phone drives me nuts at times :stuck_out_tongue:

Yes, you are correct about the tabs. The Arduino VisiGenie library comes with a 4D Workshop file for testing. If you want, I can add it to the repo.

1 Like

LOL. When youre a noob, you believe anything an Elite tells you. If you had said create a Cyclodinkatron, I would have Googled it.
I found the demo thanks, will try it tonight if I can find a level shifter lying around.

2 Likes

So I am not having much success. I tried first with an Arduino, using the Arduino Demo Sketch and it works fine. I am even connecting the Arduino through the level shifter, so all I do is transfer the wires to the Spark, running the genieSpark demo and there is nothing. It is resetting the display ok. With a scope I see no activity on the TX line at all.
Any ideas?

I did some debugging and it is getting stuck anytime there is a genie.Write.
genie.WriteStr(0, GENIE_VERSION);
If I comment out the above line it gets stuck on the next write line
genie.WriteObject(GENIE_OBJ_COOL_GAUGE, 0x00, gaugeVal);

@MagicTech I forgot to change the baud rate in the demo code. Change the line:

Serial1.begin(200000);  // Serial1 @ 200000 (200K) Baud

to

Serial1.begin(115200);  // Serial1 @ 115200 (115K) Baud

Don’t forget that you need to program your 4D display for that baudrate as well.

Hmm, i changed it both sides but it still hangs at the same place.
I posted another issue, whenever I have a sketch like this that has Serial Commands, the Web IDE will only flash it once, a second attempt (like if you edit something) will do nothing, just keep breathing Cyan. a Sketch without Serial is fine and can be re-flashed.

I dont know if this has anything to do with my issue?

@MagicTech, which 4D display are you using. I realized that some are 5v displays while the Spark is 3.3v so the rx/tx lines may not be compatible.

The issues with the Serial stuff tells me there is most likely a while() somewhere in the code waiting on serial data and hanging the background task This will prevent the OTA programming from working. I will review the code to see where that might be and also use a logic analyzer to see if the VisiGenie driver is at least putting out some data.

@MagicTech, without any display connected, I setup my spark with the VisiGenie firmware and monitored the Tx line to see if data was being transmitted. I was able to see the WriteContrast() data got out just fine but without a display, the code will wait for a response from the display before proceeding. I will see if I can hook up my 4D display and go from there. :smile:

Thanks Peekay.
Much appreciated. I am using the uLCD32 right now. I have a bi-directional level shifter in the serial lines.

@MagicTech, I found the problem! The code had a conditional compile section that would ONLY work on an Arduino and made no sense to have anyway. This section of code prevented characters from being received from the 4D display! Commenting out the compiler directives fixed it. I have my uLCD-24PTU working like a charm. Like you, I used a level converter for tx and rx. Grab the updated file from my repo and let me know how it goes. :smile:

2 Likes

Thank you, Thats awesome that you made it work. Unfortunately it still does not for me but at least I see some activity on the TX line at the start, but then all goes dead.
At least I know you have it working and I will have to check my wiring tomorrow.

Thanks again. I owe you a beer.