Shop OBEX P1 Docs P2 Docs Learn Events
Anybody Know a good way to learn SPIN? — Parallax Forums

Anybody Know a good way to learn SPIN?

Hello, I am trying to learn SPIN, and need a better way to do so. My platform for my Prop is the Propeller BOE. Does anybody out there know a good technique?

Comments

  • Read the Propeller Manual that comes with the Propeller Tool (under Help). Look at the sample programs provided and try modifying them. But mainly, just start programming! You'll make a lot of mistakes, but that's how you learn. When you get stuck on something, post your questions in the Forum, and you'll get the help you need!

    -Phil
  • Have you tried the Learn pages designed for the BOE and SPIN?
    https://learn.parallax.com/tutorials/spin
    Specifically, are the "Get Started with the Propeller Board of Education" page:
    https://learn.parallax.com/tutorials/language/spin/get-started-propeller-board-education

    As a whole, it is hard to find the SPIN tutorials now. With the push for C and BlocklyProp, SPIN has taken a back seat in my opinion. I still program primarily in SPIN (as do many, many others) so I am sure there will be others that add more SPIN resources that I forgot about or didn't recall.

    When I learned SPIN, I simply loaded demo code from various accessory product pages, the OBEX, or the forums. From there I dug in to the code and began manipulating parts to understand the changes. After that, I went through the Propeller Education Kit and migrated projects to the BOE, Activity board, and even the Quickstart. The Propeller Education Kit PDF can be also pulled from the Propeller Tool software under the Help menu (along with the Propeller Manual for all things syntax!). In my opinion, the PE Kit book and the Propeller Manual is what taught 70% of what I know of the Propeller. The other 30% came straight from these forums and fellow forum users answering my questions.

    Other:
    Link to additional Propeller Documentation and app notes
    https://learn.parallax.com/educators/teach/spin-programming-multicore-propeller
    some links on this thread may be broken, but: https://forums.parallax.com/discussion/comment/1049896/#Comment_1049896



  • Thank you, by the way, WBA, I was just reading about your GeoCache project. Neat idea! I put a similar lock on my desk drawer but could not put any password or anything on it. I pulled on a cork attached to a string to open it.
  • Same way you get to Carnegie Hall: Practice, practice, practice.
  • Agreed!
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2018-04-04 02:21
    I started when they had the Spin tutorial in the Prop manual. I would load it and make sure it ran, and then I would break it. Unlike my big sister's walking doll that I took apart when I was knee high to a grasshopper, you can break software over and over again (and it doesn't chase you around the house).

    My introduction to the Propeller was when they still had the Spin tutorial in the Prop manual. I would go through each exercise step by step, made sure it worked the way it was supposed to, and then I would "break" it by slowly modifying it until it didn't work anymore. Understanding what made it break was just as important as knowing what made it worked, because only then would I "understand" why it worked.

    Looking at those links to the Parallax site though it is sad to see that there are extensive tutorials for C, and then Blockly, and then PBASIC, and lastly Spin, as if they are ashamed of it. But Spin is very easy to learn and if you "break" something, the important thing is that is mostly the software, and not a complicated tool, so you know where to look. So the 3Ps of learning, that of Practice Practice Practice can in "practice" be practised in this manner :)
  • work through the prop ed manual, then think of something you would like to do/make and run with it. Feels more like fun than learning.
  • MIchael_MichalskiMIchael_Michalski Posts: 138
    edited 2018-04-05 17:21
    Just remember the "14 Ps" Particularly patient proactive practice positively predicates practically precise poly-processor Parallax Propeller programming paradigms. :-)
  • Awesome, I like to point beginners to Dave Scanlan's 2006 tutorial thread that came about when the Propeller itself was new, and literally everyone was new to it.
    spin-code-examples-for-the-beginner-public-version
  • Thank you, Tracy, for that fantastic link to learning SPIN!
    I tried the very first example in Dave's thread and Propeller Tool and Propeller IDE did not like the following statement:
    DirA[noparse][[/noparse]Pin] := Out                 'Makes port A16 an output port
    
    with the following error message:
    Propeller Spin/PASM Compiler 'OpenSpin' (c)2012-2013 Parallax Inc. DBA Parallax Semiconductor.
    Version 1.00.70 Compiled on Mar 20 2014 11:35:10
    Compiling...
    I:/Users/Admin/PropIde Work/Blink_one.spin
    I:/Users/Admin/PropIde Work/Blink_one.spin(52:8) : error : Expected an expression term
    Line:
      DirA[noparse][[/noparse]Pin] := Out                 'Makes port A16 an output port
    Offending Item: noparse
    
    Removing all references to noparse allowed the program to compile and seemed to run as indicated - blinking an LED on A16 5 times.

    Can someone explain what noparse was supposed to do?
  • I think that’s the web browser adding control characters.
  • RaymanRayman Posts: 13,800
    Yeah, look at the pdf version instead...
  • Thank you Jeff & Rayman, I will work from the PDF file instead of the inline listings.
  • The noparse was a way to get the old forum software to ignore certain characters to prevent SPIN code from getting eaten by the forums thinking they were text formatting commands. (like the single left bracket between the noparse commands in your example) When the forum was converted, some of the noparse HTML came over as text and inadvertently ended up corrupting the SPIN code in the new forum.
  • Clock LoopClock Loop Posts: 2,069
    edited 2018-04-05 02:11
    IF learning spin is a bit too intense for people, I suggest starting with a basic stamp 2. (BS2)


    Spin is kinda like a complex version of basic in my opinion.


    The biggest tool any new or old programmer has, is full page prints of every command possible with examples below the command description and syntax.


    Use one page per command to allow plenty of examples in the extra space(and on the back), laminate them, and use them like a deck of cards that you try to memorize(or can flip through real fast)
    (this is great in the classroom)

    This might be a good idea for a parallax product.. Command with syntax plus examples, laminated flip card deck sets for specific languages.


    Opening the pdf manual and pressing CTRL+F is also useful, but sometimes we don't know what or how to do, what we are doing and flipping through commands till you see something that might work... seems easier with a deck of cards...
  • JonnyMacJonnyMac Posts: 8,912
    edited 2018-04-05 02:34
    I don't find Spin complex at all -- in fact, it is simpler than BASIC in some ways. And, it's practical. I'm lucky in that I make a good chunk of my living designing Propeller-based products and coding them, and I always code in Spin. These are some of the things that I'm working on or have completed.

    -- industrial road sign controller and associated display controller (they communicate via RS-485 or XBee)
    -- professional laser tag controller
    -- multi-camera pan/tilt controller (uses XBee between base and camera platforms) -- pan/tilt platforms use LANC to control camera
    -- paratrooper jump trainer for US Army
    -- kiddie ride controller
    -- DEF CON 22 badge (with Parallax and Ryan Clarke who also used to work at Parallax)
    -- EFX-TEK AP-16+ Audio player (serial/DMX)
    -- EFX-TEK AP-8+ Audio player (serial)
    -- EFX-TEK FC-4+ Lighting controller (serial/DMX)
    -- EFX-TEK HC-8+ DC lighting controller (serial/DMX)
    -- EFX-TEK RC-4+ Relay controller (serial/DMX)
    -- DMX lighting controllers for multiple companies

    (Full disclosure: I'm one half of EFX-TEK)

    Those are the ones I can remember -- there has been a lot more over the past 10 years. And the HC-8+ is very general-purpose and gets used in a lot of applications. Lately the escape rooms industry is loving the HC-8+ and I write a lot of puzzle code for companies that build escape rooms and associated products.

    You can see some of the artistic work I've done with the Propeller -- again, programmed in Spin -- on this page:

    -- https://www.pinterest.com/jonmcphalen/techno-art/

    As with anything new it will take a little time to learn, but it's worth it. I find it allows me to adapt to my client needs very quickly. Those Hollywood projects are usually programmed under a lot of pressure with very little time.

    You can see more of my projects in the Customer Projects section.

    Go easy on yourself, and do try to give yourself a little time each day.
  • Again, thank you all. The "noparse" thing has cofused me since I started the Forums, no longer. JonnyMac, Rayman, others, thank you for the help with learning Spin. I am soon to begin with this.
  • RaymanRayman Posts: 13,800
    Wish I could remember the joy of toggling my first LED... I think that was with a Basic Stamp. But, I think Jon is right that Spin is better...
  • I remember. It was so exciting!
  • Clock LoopClock Loop Posts: 2,069
    edited 2018-04-07 04:39
    Rayman wrote: »
    Wish I could remember the joy of toggling my first LED...



    And then one day you try using the led as a sensor.. and the joy starts all over again..

    (i created an entire project based on using the led as an emitter AND sensor)
    http://forums.parallax.com/discussion/comment/1248240/#Comment_1248240
  • Awesome! Does it Work?
  • Never mind, it so does. How did you use the LEDs as inputs?
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2018-04-07 22:50
    There is a post about using an LED as a light meter in the tutorial thread that I linked to earlier. Specifically,
    https://forums.parallax.com/discussion/comment/574644/#Comment_574644
    That was one of my first projects on a Propeller. Satisfying, right behind flashing the LED. Read it and flash it in quick succession.
  • Alright, lets see if I can try it out.
  • Hi,

    I like to learn through reading. There are a couple of decent books on Amazon that I have read:

    Getting Started With the Propeller
    ASIN: B004X6U6II

    Programming the Propeller with Spin: A Beginner's Guide To Parallel Processing (Tab Electronics)
    ISBN-13: 978-0071716666

    The first is a quick read but contains a lot of really useful information. The second book has a bit more detail but is (at least for me) about twice the length it should be. The author repeats far too much for my taste. Still, I think both are useful.

    Hope this helps!

    Jim

  • Another book is "Programming and Customizing the Multicore Propeller Microcontroller", ISBN 978-0-07-166450-9. The first 3-4 chapters make up an introduction to the Propeller and its use. The rest of the book uses a variety of projects to demonstrate how to use the Propeller. These include a balancing robot, computer vision demonstration, and vocal tract synthesizer that can sing a Gregorian chant in 4 part harmony in stereo.
  • Yes - I have read that as well. Excellent book, but slightly more advanced.
  • @Jim_Arlowe,

    first of all welcome to this forum. Be warned right at the beginning that the Propeller and this forum are very addictive.

    I am a quite fast reader and read a lot. But as I hit SPIN for the first time I started with the PE-Kit, breadboarded my first Propeller and just dove into all the sample programs provided with the PropTool.

    I have to admit that the language has it's 'quirks', most confusing the max and min being the wrong way around.

    But else it is a very nice and thought thru language.

    Like you can not learn to ride a bike by reading about it, you can not learn a language by reading about it. You need to practice it, play around with it.

    And that is where the Propeller shines. You can get very fast success because of the overall simplicity.

    Start with some serial Object and a terminal program and you have in a couple of lines some input and output routines as a testbed for any future exploration.

    and Enjoy it,

    Mike
  • GenetixGenetix Posts: 1,740
    edited 2018-06-03 03:20
    Jim_Arlow,

    The Propeller Education Kit text was designed for beginners such as yourself and it is what gave me a good introduction to Spin.
    https://www.parallax.com/sites/default/files/downloads/122-32305-PE-Kit-Labs-Fundamentals-Text-v1.2.pdf
    https://www.parallax.com/downloads/propeller-education-kit-labs-fundamentals-example-code

    This might also be helpful. (text and code links are on the bottom) - Based on What's A Microcontroller for the BS2
    https://www.parallax.com/news/2015-07-09/now-available-preview-whats-multicore-microcontroller-chapters-1-6

    If you feel adventurous then look this over. (links on the bottom for text and code)
    https://www.parallax.com/news/2015-02-26/download-new-book-jon-titus-experiments-propeller-quickstart

    Of course the best way to learn is to look at programs written by others and if you have any questions just ask.
  • I will be ordering a PE Labs Kit and book near the end of summer, when I am done moving.
Sign In or Register to comment.