cajundust
Posts: 5
Joined: Tue Nov 06, 2012 8:11 pm

Java and 4D Systems intelligent LCD display

Tue Apr 08, 2014 11:31 pm

I recently aquired the intelligent display starter kit of 4D Systems (the SK-43PT-Pi ) and after some googling around, I cannot find a starting point of how to interact with this display in Java.

What I've learned is a little bit disappointing: the user interface has to be developed with a tool under ... windows.... as I am a linux user, this poses a real problem.

Secondly, I need to communicate with serial com port under java (also a challenge, hope that RxTx is available under the Pi)

Thirdly.... haa anyone had some experience with this ? or is it better to develop some middleware (C, python, ...) that does the serial communication, and interact with java, eg. via TCP sockets ?

Any advice is appriciated !
(oih, did I mention I do not know C or python :-/ )

cnesan
Posts: 2
Joined: Mon Jul 28, 2014 1:42 pm

Re: Java and 4D Systems intelligent LCD display

Mon Jul 28, 2014 1:50 pm

Hi,
You must use the library Pi4J with Java SE or Library io with Java ME

bye

noxo
Posts: 16
Joined: Tue Jul 31, 2012 6:52 pm
Location: Vantaa, Finland
Contact: Website

Re: Java and 4D Systems intelligent LCD display

Tue Jul 29, 2014 8:08 pm

Yes, there is RX and TX in RPI GPIO connector. TX and RX are GPIO pins 8 and 10 (http://elinux.org/RPi_Low-level_peripherals). In addition you only should need to connect VCC and GND.

I think your 4D Systems display needs only serial port connection (RX and TX), so you don't need to even use PI4J library (which is defacto Java library if you need further control/more pins over GPIO).

Instead you can probably just use JSSC (or similar) Java serial port library and straight connect serial port to /dev/ttyAMA0 (this device points to RX and TX pins).

Looks like there's already Java project, which uses JSSC to communicate to other 4D Systems display (Picaso model) https://github.com/The-Shadow/Picaso-Se ... va-Library. If you compare this one to the example provided by 4D System for your display, https://github.com/4dsystems/ViSi-Genie ... /geniePi.c you see that it only needs some minor changes (or maybe none).

All this can be done in Java, no question, good luck :)

Aliweljbh29
Posts: 5
Joined: Fri Sep 18, 2015 3:14 am

Re: Java and 4D Systems intelligent LCD display

Fri Sep 18, 2015 3:41 am

Hi can anybody help me I've also purchased a 4d systems 43 pt intelligent display and have managed to put together some code and I'm able to get a reply from the host ,(example relay is on , relay is off ) when I press a button that I have made in workshop 4 and uploaded to to screen . I'm struggling which operating gpio pins can anybody help ? Here's my code

Thanks john

#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <wiringPi.h>


#include <geniePi.h> // To handle the 4D Systems ViSi-Genie Display

int main ()
{
struct genieReplyStruct reply ;

printf ("\n\n\n\n") ;
printf ("Relay On/Off Demo\n") ;
printf ("=================\n") ;

// Standard wiringPi Setup

if (wiringPiSetup () == -1)
{
fprintf (stderr, "rgb: Can't initialise wiringPi: %s\n", strerror (errno)) ;
return 1 ;
}

// Genie display setup
// Using the Raspberry Pi's on-board serial port.

if (genieSetup ("/dev/ttyAMA0", 115200) < 0)
{
fprintf (stderr, "rgb: Can't initialise Genie Display: %s\n", strerror (errno)) ;
return 1 ;
}

// Big loop - just wait for events from the display now

for (;;)
{
while (genieReplyAvail ())
{
genieGetReply (&reply) ;
handleGenieEvent (&reply) ;
}
usleep (10000) ; // 10mS - Don't hog the CPU in-case anything else is happening...
}

return 0 ;
}

void handleGenieEvent (struct genieReplyStruct *reply)
{
if (reply->cmd != GENIE_REPORT_EVENT)
{
printf ("Invalid event from the display: 0x%02X\r\n", reply->cmd) ;
return ;
}

if (reply->object == GENIE_OBJ_WINBUTTON)
{
if (reply->index == 0) // Relay1 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay1 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay1 OFF\n");
}
}
else if (reply->index == 1) // Relay2 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay2 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay2 OFF\n");
}
}
else if (reply->index == 2) // Relay3 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay3 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay3 OFF\n");
}
}
else if (reply->index == 3) // Relay4 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay4 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay4 OFF\n");
}
}
else if (reply->index == 4) // Relay5 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay5 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay5 OFF\n");
}
}
else if (reply->index == 5) // Relay6 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay6 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay6 OFF\n");
}
}
else
printf ("Unknown Winbutton: %d\n", reply->index) ;
}
else
printf ("Unhandled Event: object: %2d, index: %d data: %d [%02X %02X %04X]\r\n",
reply->object, reply->index, reply->data, reply->object, reply->index, reply->data) ;
}

User avatar
DougieLawson
Posts: 35537
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Java and 4D Systems intelligent LCD display

Fri Sep 18, 2015 5:58 pm

Aliweljbh29 wrote:
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <wiringPi.h>


#include <geniePi.h> // To handle the 4D Systems ViSi-Genie Display

int main ()
{
struct genieReplyStruct reply ;

printf ("\n\n\n\n") ;
printf ("Relay On/Off Demo\n") ;
printf ("=================\n") ;

// Standard wiringPi Setup

if (wiringPiSetup () == -1)
{
fprintf (stderr, "rgb: Can't initialise wiringPi: %s\n", strerror (errno)) ;
return 1 ;
}

// Genie display setup
// Using the Raspberry Pi's on-board serial port.

if (genieSetup ("/dev/ttyAMA0", 115200) < 0)
{
fprintf (stderr, "rgb: Can't initialise Genie Display: %s\n", strerror (errno)) ;
return 1 ;
}

// Big loop - just wait for events from the display now

for (;;)
{
while (genieReplyAvail ())
{
genieGetReply (&reply) ;
handleGenieEvent (&reply) ;
}
usleep (10000) ; // 10mS - Don't hog the CPU in-case anything else is happening...
}

return 0 ;
}

void handleGenieEvent (struct genieReplyStruct *reply)
{
if (reply->cmd != GENIE_REPORT_EVENT)
{
printf ("Invalid event from the display: 0x%02X\r\n", reply->cmd) ;
return ;
}

if (reply->object == GENIE_OBJ_WINBUTTON)
{
if (reply->index == 0) // Relay1 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay1 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay1 OFF\n");
}
}
else if (reply->index == 1) // Relay2 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay2 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay2 OFF\n");
}
}
else if (reply->index == 2) // Relay3 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay3 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay3 OFF\n");
}
}
else if (reply->index == 3) // Relay4 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay4 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay4 OFF\n");
}
}
else if (reply->index == 4) // Relay5 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay5 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay5 OFF\n");
}
}
else if (reply->index == 5) // Relay6 Button
{
if (reply->data == 1)
{
// Set Relay ON
printf ("Set Relay6 ON\n");
}
else if (reply->data == 0)
{
// Set Relay OFF
printf ("Set Relay6 OFF\n");
}
}
else
printf ("Unknown Winbutton: %d\n", reply->index) ;
}
else
printf ("Unhandled Event: object: %2d, index: %d data: %d [%02X %02X %04X]\r\n",
reply->object, reply->index, reply->data, reply->object, reply->index, reply->data) ;
}
Why are you posting C code in the Java forum?
Note: Having anything remotely humorous in your signature is completely banned on this forum. Wear a tinfoil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Patelabhishek
Posts: 1
Joined: Mon Feb 20, 2017 9:41 pm

Re: Java and 4D Systems intelligent LCD display

Mon Feb 20, 2017 9:50 pm

Hi, every one

I am new in raspberry Pi.

so my question is, here they did't provide read and write object so how we change value of object?

Return to “Java”