Shop OBEX P1 Docs P2 Docs Learn Events
And again: Which language to start for P1 — Parallax Forums

And again: Which language to start for P1

Hello Everyone,

I know there has been discussions in the past but I think things have changed since the P2 is on the horizon. Maybe there are new arguments for any of the language.

From today's perspective what ist the best for me?
To learn the P1 I want to program a self made robot with OLED, LEDs, push buttons, ADC and 6DoF Sensors (Maybe a independent thread will follow).

Later I would love to go on with the P2

For me it looks like:

SPIN
+ Made for the P1
+ time sensitife functions can be done by PASM
+ OBEX is available
+ good support and tech papers; I have the book from Harprit Sandhu
+ apparently lots of forum members love it
+ I already could do LEDs blink. (But that's all.)
- not recommended for the P2, so I have to start again
- no standard language

C / C++
+ Is for P1 and P2
+ I have some experience programming an Arduino
+ some documentation for P1
- few libraries exists, so slower motivation relapsing

BlocklyProp
+ looks like fun
+ I can teach the kids earlier than C or SPIN
- I know nothing about
- I want to improve my coding experience

Else / Tachyon Forth
+ maybe speed
- I do not know a singe thing of other languages
- less documentary, less people who can help
- less or no libraries

So what would you recommend for me or others in my situation right at this moment?

Without P2 I propably would go for SPIN, but now I'm really uncertain.

Any comment is wanted.

Thank you a lot,
Joi


Now the boring part - my introduction

I started 1998 with the SCENIX SX28. I still have samples with 100 MHz. So around 2005 I bought a Propeller Starter Kit. I had to little time to busy myself with it, but I always wanted to. So year after year I bought some eval boards, made my own PCB (to try the samples from Sandhu) and last year I built my own robot. But I never programmed these things except to let LEDs blink! This MUST change.
I always was a silent reader here at the forum. Now I have the motivation to dip into the propeller. Slowly but strong. Please help.

Comments

  • Welcome to the forums Joi !

    Glad you took the leap from silent reader.


    About SPIN... that does work with P2 already, and you can find the spin2gui or SpinEdit software in this forum. I'd recommend you try both as they have different approaches. So your effort learning SPIN for P1 would not be wasted.

    Another route to take is with BlocklyProp. And from the blocks you can export an entire C project that you can tweak with SimpleIDE.

    As I see it....

    SPIN takes a little more time to get started than BlocklyProp, but in the long run is a very efficient way to code on the Propeller. It's probably closer to Basic than C. There are lot's of resources available from Parallax and third-party contributors on the Parallax OBEX.

    BlocklyProp gets you started really fast, and is great for most any age. You can export projects to C, so it's also a gateway to learning C development. You won't find so many code resources for sensors that are not supported by Parallax. C projects can be rather resource-heavy on the Propeller. It's difficult to share other C code snippets without re-jigging them for Propeller C, so the idea of code portability from other platforms doesn't always work "Stress free"! I suppose everything takes time in the end, one way or another.


    Personally I try to stick with SPIN as much as possible. I do maintain a couple of larger complicated Propeller C projects, but for me I find that they are significantly more effort (more time consuming) than SPIN projects.

    If your requirements are met by BlocklyProp, then it sure is a fun way to start. It can do a lot more than just blink LEDs, and it's growing fast with every new sensor Parallax releases.

    There's a new environmental sensor coming out very soon, for example, which will have full Blockly support.

  • Cluso99Cluso99 Posts: 18,066
    I would suggest P1 and spin.

    Why, because spin is mostly simple. It has lots of support with obex libraries and demo programs. There is lots of help on this forum.

    Spin enforces the good programming habit of indentation. You can start with the easy instructions and graduate as you learn.

    Then you can progress to pasm when you want.

    P1 doesn’t have interrupts so you don’t have to worry about learning the intricies of them. Instead you use separate pieces of code running on different cores/cpus (we call them cogs on P1).
  • I think Spin and PASM are very nice together and fastspin supports P1 and P2. But be aware that SPIN on the P1 normally uses a Bytecode Interpreter making very good use of the available memory while fastspin an propgcc compile basically to assembler.

    So for large programs SPIN/PASM is usually better, for faster programs C/BLOCKLY/fastspin are better, but you will quite fast run out of memory on the P1.

    I am living as a programmer since almost 30 years and found out that the language itself does not really matter, it is the way of thinking you need to learn.

    I nowadays mostly program in C# but had some short stunt at CISCO to fix some problem there and they needed it done in Visual Basic. Yeah, honestly. I hadn't touched Basic since about 20 years, but it took me maybe a day to get used to it again and the code convention used at CISCO.

    I currently start writing software for the P2, and need to learn the differences, I really love to program P1 and P2 in assembly, but that is just my choice.

    Enjoy!

    Mike
  • What about FastSpin? You get Spin, PASM, BASIC and C in one compiler and easily can mix all these languages in one project.

    If something really needs the bytecode interpreted Spin, then OpenSpin is a portable solution for Spin and PASM.
  • I prefer C as it is universal and has been around long before SPIN was even imagined. It can be transferred to all platforms with some coding changes but still the same language. It is faster than SPIN and requires no assembly language to produce fast code although some really time sensitive code uses assemble code which is still available in C.

    I know C from other platforms and systems so it was a no brainer for me since I was already there. Most of the things I build or put together I was able to find libraries in Arduino or built myself with some time put in, but I was looking for a challenge anyway.

    I have put together more than 20 custom libraries that support a lot of different devices. I have almost never used the OBEX as there is nothing in there that I would use. I even rewrite the C libraries that parallax builds just because there confusing and they don't work the way I want them too. I'm a hack.

    Loving the journey.

    Mike
  • I have both of Harprit's books and I have to say that they are not the best. I much prefer the "Programming and Customising" publication.

    However, I have been programming the Prop 1 using PropBASIC because I regard it as a RAD tool for PASM; create code, using a BASIC syntax and the compiler simply translates it to the PASM equivalent. It frees me up to concentrate on what I want to achieve, rather than how to achieve it.
  • Cluso99 wrote: »

    Spin enforces the good programming habit of indentation.

    I use indentation for readability but it's been a while since I worked with Spin.

    In BASIC, the compiler picks up on such things as "IF with no END IF", "DO with no LOOP", "FOR with no NEXT".

    Omitting the indentation in Spin simply results in the logic not working, correct?

  • All the languages for P1 are either already available for P2 or will be by the time you can get your hands on one. For that reason, I'd say not much has changed and you should just reference the old threads.
  • exactly @DavidZemon, and thanks again for providing the build server. This is really helpful to find everything up to date in one place.

    And I would be interested in @Mickster's opinion about fastspin(basic), because I find it quite nice, especially the print # stuff not doable in Spin.

    But I am not much into basic, so I ask.

    Enjoy!

    Mike
  • High all,

    thank you so much for all the answers!

    It was new for me that the P2 can be programmed with SPIN. I missed that info so far.

    So I think I will go with SPIN, because it is efficient for the P1. And there is OBEX what probably helps me to get results earlier for my robot project. This is good for my motivation. And for future prospects I can keep going with the P2.
    So lets go and start with what I already have: The book from Harprit Sandhu and the "Propeller Education Kit Labs". That should help. Perhaps I get the book "Programming and Customising".

    And if I find time, I can play a little bit with BlocklyProp or C - just for the journey.

    Again thank you very much!

    Joi
  • msrobots wrote: »
    exactly @DavidZemon, and thanks again for providing the build server. This is really helpful to find everything up to date in one place.

    And I would be interested in @Mickster's opinion about fastspin(basic), because I find it quite nice, especially the print # stuff not doable in Spin.

    But I am not much into basic, so I ask.

    Enjoy!

    Mike

    Hey Mike,

    Itching to try it but I just can't seem to get back to my Prop stuff....just too swamped with my business.
    I purchased all the remaining stock from spinvent.co.uk, ages ago. I opened the packages and put it all away...not touched it since. Yet I am checking this forum, multiple times daily and my Prop to-do list keeps on growing :lol:
  • So I think I will go with SPIN
    Good idea. It will help you learn the ins and outs of the Propeller -- if you change to a new language later, IMO you'll be better equipped to deal with it.
Sign In or Register to comment.