Shop OBEX P1 Docs P2 Docs Learn Events
Advice on using python instead of VB or C# — Parallax Forums

Advice on using python instead of VB or C#

carlyncarlyn Posts: 78
edited 2012-11-02 18:02 in General Discussion
I want to continue doing experiments with propellor and basic stampsd, Ive always used VB or c# to communicate with the chips. But Ive swiched over to linux ubuntu. And I like it. I have enough trouble programming properrlors and basic stamps. One thing I liked about the microsoft languages was the seial port object that , you didnty even know how how it worked it just did, but with a language like python I could do thee same thing with a few lines of code I guess. And Ive heard it easy to pick up even if i have to go and buy a book. The ide I have on my ubuntu system for python is the simplest ide ive ever seen. Just to give me anidea, could someone post the cost the code so that I can send and recieve from the basic stamp or prop ?

Mike.

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-11-01 05:59
    Well, if you are in Linux, any Linux... that is, Python is a choice for a lot of things - small or large. But you have C and C+ equally available in resident GCC. And a whole slew of other languages.

    VB in Linux? Can that be done without running a Windows virtual OS?

    Serial in Linux is a bit different. Personally, I think it is easier once you understand the key basic principles of Unix/Linux.

    A. Everything gets 'mounted' as a file system - included i/o ports
    B. There are just two modes of data transfer - by character stream and by blocks. Blocks are faster and used mostly for hard disk and video.

    These days, Ubuntu easily supports USB to serial as a device - often listed as USBtty0 or some other number in the /dev directory. But the simple fast is I just load BST in Linux and use it, I've never had to fool with configuration of the serial ports in recent versions. But I do suspect you can confuse Linux if you have several applications open at the same time - like TeraTerm and BST. They will not be allocated the same USBtty# and if you have only one USB to serial device plugged in, something will go without.
  • Heater.Heater. Posts: 21,230
    edited 2012-11-01 06:15
    carlyn,

    All you need on the PC is pySerial http://pyserial.sourceforge.net/. Not sure but it may already be installed on most Linux distros. It's easy to install if not.

    On the Propeller just use FullDuplexSerial and you are in business.
  • carlyncarlyn Posts: 78
    edited 2012-11-01 11:25
    Well, if you are in Linux, any Linux... that is, Python is a choice for a lot of things - small or large. But you have C and C+ equally available in resident GCC. And a whole slew of other languages.

    VB in Linux? Can that be done without running a Windows virtual OS?

    Serial in Linux is a bit different. Personally, I think it is easier once you understand the key basic principles of Unix/Linux.

    A. Everything gets 'mounted' as a file system - included i/o ports
    B. There are just two modes of data transfer - by character stream and by blocks. Blocks are faster and used mostly for hard disk and video.

    These days, Ubuntu easily supports USB to serial as a device - often listed as USBtty0 or some other number in the /dev directory. But the simple fast is I just load BST in Linux and use it, I've never had to fool with configuration of the serial ports in recent versions. But I do suspect you can confuse Linux if you have several applications open at the same time - like TeraTerm and BST. They will not be allocated the same USBtty# and if you have only one USB to serial device plugged in, something will go without.
    yeah Loopy, thx for responding. I know there are other languages, like C, I just dont want to learn it. I gave away an arduino because I'd rather program the prop language than that thing! Maybe BST in Linux is easier than python and you never have to fool with serial!.

    I did run Ubuntu using virtual box in windows and got to liking it. So I set up some partitions and now dual boot mostly Linux I tech Gimp, that photoshop type program. Seems more stable on Ubuntu than windows. I didnt have to supply drivers for my very new printer and modem router either, Ubuntu 'new' what things I had plugged in and they just worked. Is there a flavor of Linux as good as Ubuntu thinking of tripple booting :) I can always just boot into windows and continue using VB, I just wanted to fully migrate to Linux....eventually. So I will try out Heaters suggestion below. Thank you very much though.
  • carlyncarlyn Posts: 78
    edited 2012-11-01 11:33
    Thanks Heater, I'll try to get that working. Pretty sure I will get it right.

    Quick note to Loopy, yes I think using Mono you can actually program C# and VB and others in Linux. I installed Mono, but for me too many notes and ropes to learn to get that right !!!. If I really wanted to keep using VB I'd just boot into windows. I think I just want to learn python becuse I know other peole here do but probably in windows?????? or not !
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-11-01 11:38
    carlyn wrote: »
    Maybe BST in Linux is easier than python and you never have to fool with serial!.

    This comment confuses me. BST has worked on Linux and SimpleIDE 0-8-5 now offers SPIN support on Linux/Windows/Mac. That will get you PROGRAMMING on the Propeller side. I don't think there is a native Linux solution for the BS2, I don't think so.

    Python isn't going to help you program either but it would allow you to write a program to talk to an application running on either from the PC side via a serial connection. You probably are aware of that and your statement above was just confusing.
  • carlyncarlyn Posts: 78
    edited 2012-11-01 12:11
    Sorry about being confusing. But thank you for your input. It just gets more interesting. I haven't gone near my electronics for 12 months very much. I'm now keen to look at SimpleIDE.
  • carlyncarlyn Posts: 78
    edited 2012-11-01 12:45
    mindrobots wrote: »
    This comment confuses me. BST has worked on Linux and SimpleIDE 0-8-5 now offers SPIN support on Linux/Windows/Mac. That will get you PROGRAMMING on the Propeller side. I don't think there is a native Linux solution for the BS2, I don't think so.

    Python isn't going to help you program either but it would allow you to write a program to talk to an application running on either from the PC side via a serial connection. You probably are aware of that and your statement above was just confusing.
    Hi Mindrobot, the list for SimpleIDE didn't have a download for my flafor, ubuntu , or Ive been told to call it oobutoo :) It has a great software center where you can install or uninstall hundreds of programs with one click. Ive only startied using the terminals to get permission to install certain extractables to change some look and feel of some programs, I will have to out and buy a book on linux as I don't have a clue about tar or tar balls and other file methods for installing in a more universal way :(
  • Heater.Heater. Posts: 21,230
    edited 2012-11-01 13:08
    There are no packages for SimpleIDE on Linux yet. It's early days, things are still under development. However installation is easy with the supplied setup script. Just follow the instructions that are on the SimpleIDE web site or in the README in the package itself. You don't need to know more than that about tar balls and such.
  • carlyncarlyn Posts: 78
    edited 2012-11-01 13:31
    Heater. wrote: »
    There are no packages for SimpleIDE on Linux yet. It's early days, things are still under development. However installation is easy with the supplied setup script. Just follow the instructions that are on the SimpleIDE web site or in the README in the package itself. You don't need to know more than that about tar balls and such.
    I think the Debian notes and download will get me there for ubuntu. They say there are no stupic questions only stupid answers, Ive got to challenge that by asking what is GCC ?
  • carlyncarlyn Posts: 78
    edited 2012-11-01 13:42
    Well that SimpleIDE looked like C from the arduino code ive tried, is there an online manual with type of C ?
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-11-01 13:46
    No, definitely not a stupid question, especially since the answer varies depending on who you ask.

    Offically, it's "GNU Compiler Collection", though it was originally only a C compiler. It now supports C++, Objective C, Objective C++, Java, Fortran, and possibly other languages.
  • Heater.Heater. Posts: 21,230
    edited 2012-11-01 13:54
    carlyn,

    ...what is GCC ?

    Good question. GCC = GNU Compiler Collection.

    GNU = GNU's Not Unix. It's recursively defined like that.

    GNU Is the name of the project to replace Unix started by Richard Stallman many years ago.

    Ubuntu is one incarnation of that idea.

    GCC is a compiler collection because it can compile C and C++ and Fortran and a bunch of other languages. Not only that but can compile all those languages to binaries that run on x86 or ARM or MIPS or Spark or a bunch of other processors. GCC is used to compile C++ for the AVR chip used in Arduino (Yes, that is C++ not C). There is a GCC to compile C/C++ for the Propeller, propgcc.

    SimpleIDE is an IDE for writing code in C or C++ or Spin/PASM. When using Spin/PASM it does not use GCC but rather an new open source Spin compiler.

    As far as I know SimpleIDE can be installed the same way for Ubuntu as Debian. I have only used Debian.

    You should have no fear of C it is a wonderful thing. C++ should be approached more cautiously. Still, nothing wrong with using Spin on the Prop. You will still need Python or something else on on the PC if you want Prop and PC to communicate over a serial link. My preference is for JavaScript running as a command line program under Node.js.
  • carlyncarlyn Posts: 78
    edited 2012-11-01 14:11
    Thanks again Heater....all good answers, from everyonr thanks. From using Gimp, its some kind of recursive name, I believe that the GNU is an imaginary animal. I thought GIMP was GRAPHICS IMAGE MANIPULATION pROGRAM.

    or could be the GNU's Not Unix. now my head hurts :)
  • Heater.Heater. Posts: 21,230
    edited 2012-11-01 14:28
    Imaginary. No. The gnu is a member of the bovid family otherwise known as the wildebeest.

    GIMP = GNU Image Manipulation Program. Many complain about that name but I love it.

    I can see now why the Arduino guys talk about "wiring" and "sketches" and carefully never mention what is actually underneath. It has saved them a lot of questions and user confusion. Personally I hate that approach. The reality is all straight forward when you get the hang of it:)
  • max72max72 Posts: 1,155
    edited 2012-11-01 14:37
    I tested simpleide under ubuntu.
    I only ran the hello program, and tested a spin project. They both worked.
    If I remember correctly there only is a little bit of command line to do.. give it a try!
    Massimo
  • carlyncarlyn Posts: 78
    edited 2012-11-01 15:08
    Thanks for going to the trouble there Massimo, are you in that show "Days of Our Lives" You can call me Ridge from the Foresters , That's what they called me in rehab.... opps ..i said to much.!
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2012-11-02 02:20
    Now there is BS2 support in Linux. I have actually used it, but I think it is command line and you just use Nedit to write programs.

    Pyserial looks mighty interesting to me. This would enable a custom interface to a BS2 or a Propeller that would look very professional.
  • MikeKMikeK Posts: 118
    edited 2012-11-02 18:02
    I've used Pyserial to communicate with microcontrollers (PICs / Windows -- I guess that's 2 strikes). It was fairly easy to do. Biggest problem I had was that if the program died or if I killed it, I had to be sure to close the serial port or I wouldn't be able to open it again without rebooting. Some day I'm going to write an exception handler.

    Mike
Sign In or Register to comment.