Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Which language should I use?

  1. Mar 17, 2016 #1
    Well, a pet project of mine is growing into a fine elephant.
    The goal was to control a Holset HE351 variable vane turbocharger.. So I got an Arduino.. and relearned my lost C++ that was never good anyhow.

    Then I wanted a display for it, so I wrote a basic one in well. VB.net, but I can't fit a computer on my dash so I can look at it while driving, (you can't tune it if you don't know what's going on) so I got a Raspberry Pi and a 7" HDMI touchscreen.

    Now what I need to do is read data from the serial port, parse the data, then display it in graphical (gauges, etc) form.
    I'm using the Raspbian OS

    I'm looking for something that's not going to torture me to learn.. and has some portability to it as well..
    I'm thinking Python or Java.. open to other suggestions
     
  2. jcsd
  3. Mar 17, 2016 #2

    jedishrfu

    Staff: Mentor

    Why not just use C on the Pi and some character graphics (ie ANSI codes) since you are familiar with it?

    For Java, I think you'll need to load some packages to get it working.

    However for Python, its there already and I think the Pygame package for graphical displays is too.

    Here's a tutorial on it.

    http://www.pygame-doku.laymaxx.de/tut/intro/intro.html
     
  4. Mar 17, 2016 #3
    I am checking out Python right now, Looked at a Hello World program, syntax looks pretty easy so far.

    I was considering Java especially for portability.. IE.. if I wanted to run it on an Android phone instead would Python still be a viable option?

    Should I concern myself with OpenGL capabilities at all? In the VB.net version I'll be darned if I can't get rid of the flicker (and yes, I googled it, enabled double-buffering and every other trick in the book).. but my computer can play any new video game with good frame rates and no flicker. I don't want to put all the work into developing something to find out it doesn't look any good when I'm done!
     
  5. Mar 17, 2016 #4

    jedishrfu

    Staff: Mentor

    Python would not work on an Android phone. However, Jython would and its syntax is mostly compatible with Python but you'd need to try out your program first.

    I think Python with Pygame would be sufficient for what you want to do.
     
  6. Mar 17, 2016 #5
    Is there an IDE for Python/Pygame that supports autocomplete, auto compile, etc.. I really don't like command line stuff that much!.. I'll take your suggestion and go with Python for now.
     
  7. Mar 17, 2016 #6

    jedishrfu

    Staff: Mentor

  8. Mar 17, 2016 #7
    I have that installed.. I'll give it a shot.
     
  9. Mar 18, 2016 #8

    Mark44

    Staff: Mentor

    I sincerely hope you aren't going to be driving on public roads when you're doing this. We already have enough people who are attempting to drive while they're checking for text messages and their witter accounts.
     
  10. Mar 18, 2016 #9
    Some of it will be, when I feel a hesitation or something I will look at it like I'd look at any other kind of gauge, no it won't be in my lap, it'll be mounted in a place that doesn't require me to stop looking at the road.
     
  11. Mar 18, 2016 #10
    What about Kivy? any experience with it?
     
  12. Mar 18, 2016 #11
    Flicker is absolutely from not doing frame swapping correctly.

    What kind of graphics are you looking for? OpenGL can do a lot of nice things with very easy code, and it's really flexible. That's a good thing if you're already familiar with it, but can be confusing if you aren't.
     
  13. Mar 18, 2016 #12
    I'm just looking to make some dial and bar type gauges and graphs.. never done anything with OpenGL before, and at this point, looking at my learning curve by doing it in an unfamiliar language to boot, is a touch daunting I will say. I don't see myself actually getting serious with this project for some time (next winter?) because I got a lot of other things to do.. but I might fiddle around a little bit.
     
  14. Mar 18, 2016 #13
  15. Mar 18, 2016 #14
    Interesting.. it seems to be in .net, perhaps I can even play with GL a little in VB, which would really help me grasp the concepts of it... My C++ is probably not good enough to really understand it.. it's just enough I can do Arduino with.
     
  16. Mar 18, 2016 #15

    Mark44

    Staff: Mentor

    I don't think so. I looked at a couple of pages at the site that newjerseyrunner linked to, and it seems to be standard C++ code using the OpenGL APIs. To the best of my knowledge this is not part of the .NET Framework, but there are third-party wrappers of the OpenGL APIs (such as SharpGL -- https://sharpgl.codeplex.com/) so that they can be used from the .NET languages.
     
  17. Mar 18, 2016 #16
    Whether or not it's .net is probably not relevant, .net I'm sure has an OpenGL context window. Getting used to the concept of matrices, views, and vectors is most important.
     
  18. Mar 18, 2016 #17
    I did study rotation matrices, vectors, and views superficially about a year ago.. it's pretty cool, and I have a marginal understanding of them now.

    I did write a little vb.net program that parsed an input file which had 2 pairs of XYZ coordinates per line (draws a line between the 2 pairs), and then rotated them in 3D space... didn't look fancy with any shading or anything, but was an interesting exercise for a proof of concept and practice.
     
  19. Mar 20, 2016 #18

    FactChecker

    User Avatar
    Science Advisor
    Gold Member

    For displaying simple dials and gauges, it is not necessary to program low level OpenGL. Look at GLUT and GLUI. They are based on OpenGL and will be much easier to use.

    PS. You will want an early version of OpenGL what allows glBegin and glEnd.
     
    Last edited: Mar 20, 2016
  20. Mar 20, 2016 #19
    Not glut, Glut has been deprecated for more than a decade.

    Also, all OpenGL has glbegin and glend. I use the latest OpenGL and I use it for most texture rendering.
     
  21. Mar 20, 2016 #20

    FactChecker

    User Avatar
    Science Advisor
    Gold Member

    I should have said FreeGLUT. glBegin and glEnd have been deprecated since OGL 3.0 in 2008, but you may be right that they are still available.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted