Display analogue input value using HelloIOIOSwing for pc

29 views
Skip to first unread message

davidco...@gmail.com

unread,
Sep 11, 2015, 2:24:15 PM9/11/15
to ioio-users
Hi. I have a win pc app based on helloIOIOSwing which uses analogue input to control led fitting light level, (dims fitting if light level is high) this all works fine, but I cannot work out how to display value in Jlabel. Can anybody give me some pointers.
Many thanks in advance.
Dave,

Ytai Ben-Tsvi

unread,
Sep 11, 2015, 3:02:06 PM9/11/15
to ioio-...@googlegroups.com

This forum is not necessarily the best place for general swing questions. Have you seen this? https://docs.oracle.com/javase/tutorial/uiswing/components/label.html
Or is your question about how to read the value from the AnalogInput rather than how to display it?

--
You received this message because you are subscribed to the Google Groups "ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ioio-users+...@googlegroups.com.
To post to this group, send email to ioio-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

davidco...@gmail.com

unread,
Sep 11, 2015, 3:39:32 PM9/11/15
to ioio-users
Hi Ytai. My problem is passing the value from the looper part of the program to the gui part if that makes sense. I have other labels with variables from Tables and Sliders that display fine. I have used the IOIO with Android devices and had no problems displaying values, I was just hoping that somebody had an example based on the helloIOIOswing program that used analogues. I have spent many hours browsing the internet and have failed to find a solution. The IOIO is a marvelous device and thanks for all the work you have put in. I am now going to read the link you have posted. Once again thanks.

Ytai Ben-Tsvi

unread,
Sep 11, 2015, 4:16:25 PM9/11/15
to ioio-...@googlegroups.com
Have your GUI code expose a setAnalogReading(float value) method, and have the IOIO code call that method. If there's any requirement in Swing like in Android) that all GUI operations are done from the same thread, use some kind of a a communication mechanism (such as a synchronized queue) to send the message across the thread boundary.

davidco...@gmail.com

unread,
Sep 15, 2015, 2:52:15 AM9/15/15
to ioio-users
Hi Ytai. Thanks for your help. Problem was somewhere else in the program I had written which was causing a rather odd conversion to occur! The error was found from reading the link you provided. Once the code was sorted the analogues read perfectly. No extra special communication  mechanism needed. The IOIO is a marvelous device, thanks once again for all your help. When program is fully sorted and commented I intend to place it on github if anybody thinks it will be helpful. 
Reply all
Reply to author
Forward
0 new messages