Shop OBEX P1 Docs P2 Docs Learn Events
Generic Logic Widgets --> Widget in Browser talking to P2! — Parallax Forums

Generic Logic Widgets --> Widget in Browser talking to P2!

RaymanRayman Posts: 14,640
edited 2022-02-12 23:58 in Propeller 2

For a particular application, looking to have a GUI on a PC that interacts with a P2 for controls.
Was going to use LabView, but now thinking about other options...

The first google result was this:
https://www.genlogic.com/products.html#Components

It appears to be a bit complex, but the end result looks pretty good.
Tried using the HTML 5 version, but turns out that has to be on a web server to work.
So, I'll probably do C++/MFC, although there are a lot of other options.

Anyway, I suppose the end result would be similar to the new Graphical Debug in Spin, but maybe with some fancier graphics...

Update 12Feb22: Just got it working with HTML5/Javascript, checkout example on my server. Very basic for now, but there's a lot of Widgets to choose from! See post #19 for more info.

934 x 1118 - 72K

Comments

  • ScroungreScroungre Posts: 161
    edited 2022-02-12 07:59

    For graphically poking around, with digital and analog circuits, I'd suggest a Spice simulator - There's several available for free.

    Dunno what talking to a P2 gets you, though. S.

    eta: Never mind.

  • RaymanRayman Posts: 14,640
    edited 2022-02-10 20:48

    @Scroungre This isn't for circuit analysis, it's more for setting up control panels for interfacing with equipment or stuff like that...

    I tried it out a bit today, starting from an C++/MFC example.
    If you run the .exe in the attached, you can interact with it.
    But, it doesn't actually do anything yet...

    It seems to only work without error messages if you have graphics card software installed...
    Otherwise, it's a bit dicey...

    Idea is you'd connect this program to P2 over serial or ethernet thereby control stuff connected to the P2.

  • SimoniusSimonius Posts: 94
    edited 2022-02-11 05:40

    @Rayman said:
    Was going to use LabView, but now thinking about other options...

    what made you change your mind?

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2022-02-11 07:31

    Tried using the HTML 5 version, but turns out that has to be on a web server to work.

    Like localhost, for example? I don't see the problem.

    My SpinScope uses a server that runs in the background on the client machine.

    -Phil

  • RaymanRayman Posts: 14,640

    @"Phil Pilgrim (PhiPi)" That's an interesting idea maybe it would work, not sure. I googled for any sign anybody tried that and can't find anything.

    @Simonius Our main Labview engineer isn't happy with the new licensing: https://www.ni.com/en-us/landing/subscription-software.html

  • Wuerfel_21Wuerfel_21 Posts: 5,052
    edited 2022-02-11 16:56

    If you have python installed, you can just do python -m http.server to run a web server that you can reach on http://localhost:8000

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2022-02-11 19:15

    SpinScope uses a simple server I wrote using Perl. Any software that listens and responds on an HTTP port can act as a server. You just have to know the port number to access it with your web browser.

    -Phil

  • RaymanRayman Posts: 14,640

    This is what the instructions say:
    To run the demos, place the demo files on a web server, since most browsers will not allow running JavaScript demos from a local file system due to the security restrictions.

    It then talkes about settings for IIS server. So, I think maybe it would work if you install an IIS server in Windows.

    Not so sure about localhost though... It uses a bunch of libraries and other files to work and seems to need some associations set for that to work:
    http://www.genlogic.com/doc_html/glgjs.html

  • It then talkes about settings for IIS server. So, I think maybe it would work if you install an IIS server in Windows.

    That appears to be the case. Not a huge deal, methinks. Which version of Windows are you using?

    -Phil

  • RaymanRayman Posts: 14,640

    I'm fine with C++/MFC. That is my preferred solution anyway. I just tried HTML5 because I thought it would be useful for others, perhaps.

    Still, I do have a real server at rayslogic.com... Maybe I'll think about if there's anything fun I could do with this there...

  • I like Labview, but the full blown version was pretty hefty, $5,000+. But it came with unlimited executables. And if you call sales, tech. etc. its all in Mexico and their english wasn't that great.

  • LabView turned me off a long time ago with data types and the lack of differentiation between function and dialog box.

    HTML5 can be a good way to go, but you do need a way to do I/O to your device. What I would recommend would be either python3 (http.server) or C (libmicrohttpd) accepting JSON commands to parse and pass over a serial port to the Prop2, and returning JSON results back to the web page. At that point, use React, Angular Material, or something else akin to make the GUI.

  • Now the Labview pro is $2,770 a year, was a $5,500 for a one time purchase. What a rip.

  • Personally I loathe Labview, but that's mostly because Nat Semi sold me a complete turd of a data acquisition card (it did not do what the salesman said it would, thus completely ruining the whole project, and what was a promising relationship with a good client). Also partially because while the widgets looked very pretty, it turned out that actually hooking them up to useful information was a raging pain. I had built a beautiful demo with fake data - but actually getting the real data did not work at all. Partially my mistake - don't make the demo too good too soon, they'll think the rest is easy.

    I'm afraid that serial (or Ethernet?) comms with the P2 are what you're going to need, and the GUI will probably have to be mostly home-made. S.

  • RaymanRayman Posts: 14,640

    Ok, I'll see if I can get something going in HTML5.
    Think I figured out how to open a serial port in a browser...
    Had to add SSL to my websites to make it work...

    Anyway, I put this test page on my website. All it does is connect to a serial port:
    https://www.rayslogic.com/GLG/SerialTest.htm

  • I have older versions that I purchased and they worked well with the P1 and Bs2, using the serial, but now with that yearly subscribtion "F" that never again.

  • RaymanRayman Posts: 14,640

    Having some trouble getting serial write to work, but maybe this serial terminal example will help:
    https://googlechromelabs.github.io/serial-terminal/

  • RaymanRayman Posts: 14,640
    edited 2022-02-12 23:53

    Ok, got an example here that lets you control pin P56 via website (when the attached Spin2 file is loaded)!
    https://www.rayslogic.com/GLG/GLG_P2_Test1/GLG_P2_Test1.html

    Couple issues:
    1. Opening the serial port appears to reset P2. So, need to load code into flash or disconnect DTR from reset (using "USB RES" switch if you have the Eval board).
    2. This website doesn't actually close the serial port yet. So, reload the web page or close it to close the serial port.

    934 x 1118 - 72K
  • @Rayman said:
    This is what the instructions say:
    To run the demos, place the demo files on a web server, since most browsers will not allow running JavaScript demos from a local file system due to the security restrictions.

    It then talkes about settings for IIS server. So, I think maybe it would work if you install an IIS server in Windows.

    Not so sure about localhost though... It uses a bunch of libraries and other files to work and seems to need some associations set for that to work:
    http://www.genlogic.com/doc_html/glgjs.html

    If you are on a linux (or almost any other flavor of box) you can always run Apache. There is no cost to it and lots of docs and examples to go by. As an alternative, you could always set up a VM with older OS/Browsers to enable running java/javascript contents.

Sign In or Register to comment.