Shop OBEX P1 Docs P2 Docs Learn Events
12Blocks- v1.2 launched! — Parallax Forums

12Blocks- v1.2 launched!

HannoHanno Posts: 1,130
edited 2010-02-27 15:54 in Propeller 1
EDIT:
I started my latest project with the thought that the Propeller is (or should be) as easy to use as a Basic Stamp. Several people chimed in that it could be even easier. One late night, I came up with the concept of 12Blocks (first named Spinner) and spent the next couple hours defining the language. This thread now nicely documents how a new product is made. Enjoy!

(Edit February 20th )
Version v1.2 is now here! Should be quite stable and lots of new features- more about that soon.
Check out the tutorial:
12blocks.com/tutorial.pdf
Read about 12Blocks in the Parallax Newsletter:
www.parallax.com/tabid/581/Default.aspx

Many thanks to everyone that's helped and inspire me- especially to my family, Brian and Chad!
Chad's starting to use 12Blocks to teach robotics to kids and says: " I really think 12Blocks
is turning out to be the best graphical programming environment for kids out there."
Hanno




ORIGINAL POST, with subject: "I think a Propeller is as easy as a Basic Stamp"
Hi,
We all know that a Propeller is much more capable than a Basic Stamp with the 8 cogs, video, counters, 32bit, assembly, adjustable frequencies, object...

I would like to make the case that for equivalent functionality, the Propeller is just as easy to use as the Basic Stamp.

That is, if all you want to do is some basic math and pin toggling at slow speed, then it's just as easy to use a Propeller as it is to use a Stamp. The Propeller Tool makes it just as easy to type a short spin program and run it on the Propeller as the Basic Stamp tool did. While the Propeller allows you to mix assembly with spin, use objects, counters and much more, you're not forced to do that. A simple program to toggle a pins state is as simple as:
pub toggle                       'a program starts with the first public procedure
  dira[noparse][[/noparse] 4]:=1                    'set io pin #4 to be an output
  repeat                         'continually repeat the next 2 instructions
     outa[noparse][[/noparse] 4]:=1                 'set io pin #4 to on
     outa[noparse][[/noparse] 4]:=0                 'set io pin #4 to off



What could be simpler? (I purposely didn't use the cryptic ~~ and ! operators, they should be banned for simple non time/space programs like this)
Why do people keep insisting that a Propeller is harder to use than a Basic Stamp? It's more CAPABLE, but it's not more difficult. Programming FPGA is more difficult- setting up the tool chain, getting something to compile, and running it on the hardware takes a Phd by itself.
Please enlighten me if I'm missing something- if there really is something, I'm sure it can be fixed with an Andy Lindsay guide or by software [noparse]:)[/noparse]
Hanno

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Co-author of the official Propeller Guide- available at Amazon
Developer of ViewPort, the premier visual debugger for the Propeller (read the review here, thread here),
12Blocks, the block-based programming environment (thread here)
and PropScope, the multi-function USB oscilloscope/function generator/logic analyzer

Post Edited (Hanno) : 2/19/2010 7:58:01 PM GMT
«1345

Comments

  • mctriviamctrivia Posts: 3,772
    edited 2009-06-30 07:36
    never played with the basic stamp but i have used:

    Renesas r8c tiny
    TI 420 day
    Motrola hc6811

    and of all of them the propeller is the easiest and most useful to work with.

    OK assembly is much easier on the hc6811 then on the propeller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    propmod_us and propmod_1x1 are in stock. Only $30. PCB available for $5

    Want to make projects and have Gadget Gangster sell them for you? propmod-us_ps_sd and propmod-1x1 are now available for use in your Gadget Gangster Projects.

    Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-06-30 07:43
    Hanno:

    If you can make a number of individual simple demo programs like this one,
    that exactly translate simple PBASIC into SPIN, it will be totally fantastic,
    immensely useful, and we'll need to label you a genius!

    humanoido

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Stamp SEED Supercomputer
    Basic Stamp Supercomputer
    Three Dimensional Computer
    Penguin with 12 Brains
    Penguin Tech
    StampOne News!
    Penguin Robot Society
  • HannoHanno Posts: 1,130
    edited 2009-06-30 07:58
    Humanoido,
    I agree with you that we need more, and simpler tutorials that make the Propeller less scary for beginners. That's partly what inspired me to start this thread. Would be great for someone to put together a bunch of simple programs that progress in difficulty. And no, the first sample should NOT start with esoteric concepts like clkfreq, plldiv, or impossible to decipher symbols like ! and ~~. Target the programs to a beginner and don't confuse them with concepts that they don't need to understand yet. Don't talk about 8 cogs, counters, video, assembly, frequency settings until they're actually required. The Propeller should be sold as the world's easiest to use processor- which is capable enough to do some really cool stuff.
    Hanno

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Download a free trial of ViewPort- the premier visual debugger for the Propeller
    Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
  • heaterheater Posts: 3,370
    edited 2009-06-30 09:55
    I have never used a BASIC STAMP and haven't tried to use any kind of BASIC since 1984 but I have to say I can't imagine how one could make using a micro controller any more straight forward than the Propeller, Spin and Spin tool system.

    This is especially great as one can go from the simplest "flash a LED" code starting, from knowing nothing, all the way up through objects, multi-processing, assembly language, video...all with the same hardware and software tool.

    I do agree that a heap of "getting started" tutorial examples with the minimum of not immediately obvious squiggles would be desirable.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • FearTurtlesFearTurtles Posts: 89
    edited 2009-06-30 13:59
    I think the difference comes from readability. With Pbasic you can for the most part understand what the program is trying to do just from reading the code for the first time. Spin requires more understanding of the language to understand what is going on. a good example of this would be
    
    Do
       high      4       'sets pin 4 to high
       Pause  100     'Pause for 1/10th of a second
       Low       4       'Sets pin 4 to low           
    Loop
    
    
    


    In the code above are the comments really needed? Maybe all that is needed is one comment to indicate what the number 4 is. So its not that tasks can be accomplished with only a few lines of code but how easy it is to understand what the code is doing with out the help of added comments.
  • bambinobambino Posts: 789
    edited 2009-06-30 14:01
    I find myself using the stamp from time to time, but honestly, if I have been in prop land for more than a month I find it difficult to program in Pbasic.

    A device I'm making needed a simple circuit at the last minute to handle charging the batteries, so instead of using the propeller for that to, I decided to use a Stamp1. I had to call tech support to re learn how to use the pins! Not that the stamp is hard, we all know it's easy to program, but when I get my head wrapped around a propeller, basic goes out the window!

    But than again maybe it's just me, when I think I am never going to use something again, I tend to forget it. A customer came in the other day wanting DOS 6.0 loaded on there computer. Not until my flash backs subsided did I remember how easy that was!


    Post Edited (bambino) : 6/30/2009 2:09:57 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-30 14:06
    One place where the "easy as" idea falls down at present is the complex I/O statements of the Stamp, particularly things like SERIN / SEROUT and the simpler variations DEBUG / DEBUGIN. The BS2_Functions library functionally helps, but it's not quite straightforward enough and there aren't enough examples. I think you're correct in that some simple sample programs and accompanying documentation would make a huge difference. I don't see why "What's a Microcontroller?" couldn't be rewritten for the Propeller using the BS2_Functions library (or a minor modification of it) and be just as successful as the Stamp version. With mpark's Sphinx and a finished simple editor, the whole thing could be made self contained (without a PC) using a small TV display and PS/2 keyboard, and a Propeller Board of Education. Something like a Demo Board in a Board of Education form factor with an SD card and an I2C I/O expander to get back some of the I/O pins.
  • WBA ConsultingWBA Consulting Posts: 2,935
    edited 2009-06-30 17:19
    As soon as Bean finishes his Propeller based Stamp Emulator, that question will be completely void. (keep going Bean!)
    http://forums.parallax.com/showthread.php?p=794096
    I'll be playing with it this weekend.

    I agree with FearTurtles as to how easy the code is to "read" without being completely fluent in the spin language. BASIC is very basic, so to speak, and that's why I was able to learn it in 7th grade (many moons ago on a TRS-80). I am really looking forward to playing with my recently acquired propeller proto board however, with both SPIN and Bean's emulator. I haven't dove into SPIN yet, but as I am looking for lower cost alternatives to stamp modules, I am heading towards the SX using SX/B for time and will be looking at the propeller for the long haul.

    I also play with Cypress' line of PSoC microcontrollers and from that, started venturing into C and assembly. I have a few good books on learning the PSoC and when I have the time to sit and read, it is easy to learn. My issue is with the time (I have none) so SX/B and Bean's Stamp emulator for the prop will be my avenue. I will still use the PSoC for a couple of my projects (capsense touch board and wireless RS232) I know that several people have stated that when allocated the proper amount of focused time, SPIN was not difficult.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    IT / Web / PCB / Audio
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-06-30 17:24
    I've just started tinkering a little with Basic Stamp, being
    complete immersed in Propeller most of the time.

    My initial impression (from a Propeller point of view) is
    that the Basic Stamp is easier commandwise, but extremely
    restricted. I'm simply SPOILED by all the features in the
    Propeller. [noparse]:)[/noparse]

    Oldbitcollector

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • jazzedjazzed Posts: 11,803
    edited 2009-06-30 17:45
    If harder means learning more, there is less to learn about PBASIC than there is to learn about SPIN.
    Of course following that with a corollary: if you know SPIN and not PBASIC, then PBASIC is harder [noparse]:)[/noparse]

    If harder means doing more with less, then PBASIC is harder than SPIN.

    If harder means someone gives you a compass to debug a power supply instead of an oscope and/or
    multimeter (an interview question I had once - no joke), then you have to stretch your mind to make it work.
    Hopefully you will end up with the right tools.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve


    Propalyzer: Propeller PC Logic Analyzer
    http://forums.parallax.com/showthread.php?p=788230
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-06-30 17:55
    Spin is actually easier than PBASIC in the following ways:

    1. Variable space: You can really spread out in Spin, if you want to, and don't have to share variables just to conserve variable space.

    2. Local variables: The use of local variables in methods reduces the chance of errors that can occur when all variables are global, as is the case in PBASIC.

    3. 32-bit signed longs: Who hasn't had to jump through hoops in PBASIC to manage large numbers and/or negative numbers?

    -Phil
  • AribaAriba Posts: 2,690
    edited 2009-06-30 18:28
    PBasic has a lot built in functions which are well described, this makes it easier for beginners, than a universal language like Spin.
    An example:
    You will output a PWM signal with 20% with on a Pin for 1 second.
    In PBasic this is 1 command, something like:
    PWM 4,20,1000
    (don't know the exact syntax, because I never coded in PBasic).

    How do you that in Spin?

    1) You read about counters and how to start new cogs, and build your own PWM object....
    2) You search for a PWM object and include it in your code. Then you need to study how this object works, how you must
    initialize it, and how to pass the pulswith and so on... and it's not shure that this informations are well described in the object.

    It's the same if you wanna count pulses, want output a frequency, want measure an RC time and much more. As long as PBasic
    has a built in command, then it's definitly easier.
    But when you need more power, or functionality which is not built in, then Spin and the whole concept of the Propeller is much easier.

    Andy
  • Clock LoopClock Loop Posts: 2,069
    edited 2009-06-30 19:50
    I started out using a BS2, then moved into the SXB.


    Spin has the same approx learning curve as SXB.

    BUT,,,, WITH the massive OBEX objects available, the prop is as easy to program as a BS2.

    However, with spin's intuitive nature combined with its almost limitless program paths..... ,

    I find myself running into walls, due to me not being able to choose HOW to go about programming it.

    There are too many choices and ways to get your end result in spin.

    Many of my ways are not efficient, but they WORK.

    I then figure out ways to trim it all down, using yet another method...

    Post Edited (Clock Loop) : 7/1/2009 12:21:04 AM GMT
  • HannoHanno Posts: 1,130
    edited 2009-06-30 20:50
    Ok, so far it seems that additional simple real world examples/tutorials and use of Martin's excellent "bs2" object would resolve the only 2 reasons why the Propeller is not as easy to use as a Basic Stamp. For those that don't know, Martin has put together an object that duplicates all the functions of the bs2- including the "high, low, pause, rctime, freqout" commands mentioned above...

    What else makes the Propeller so much harder to use than the Basic Stamp? (Again, for EQUIVALENT functionality)

    Hanno

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Download a free trial of ViewPort- the premier visual debugger for the Propeller
    Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
  • ratronicratronic Posts: 1,451
    edited 2009-06-30 21:22
    I agree Hanno , I think there could be a better written beginners guide for the propeller. I am no expert by any means, I started with the stamp then moved to the propeller after it first came out and in it's own way I find the propeller easier. I think that spin can be as easy as Pbasic with a properly written guide.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fix it, if it ain't broke·
    D Rat


    Dave Ratcliff· N6YEE
  • PropellerFanPropellerFan Posts: 4
    edited 2009-07-01 04:18
    the better manual needs:

    demo-programs about objects and cogs (sharing variables, IO-oring)

    The documentation-style of the objects has to be improved
    adding different demos with detailed explanations of the object-parameters

    programming tutorials about how debugging can be used to analyse what's going on

    programming tutorials about how to create your own new commands built up with the elementary commands of SPIN
  • waltcwaltc Posts: 158
    edited 2009-07-01 05:43
    BS2 is easier in the sense that it had a boatload of good tutorials are available that helped new programmers along.

    The Prop never had that, it just had at best a mediocre manual that really lent itself to experienced coders and is in need of revision, especially the SPIN tutorial section.

    As to the languages themselves,PBASIC is just a limited version of BASIC - its dirt simple and easy to learn period. And it had to be given that it had to fit a mc with almost no ram.

    SPIN is a mish-mash of C and other languages and as a result its more complex,quirky and flexible compared to Pbasic. Which means more of a learning curve for novices if they have no HLL experience.

    Mind you all of this is irrelevant if its experienced programmer looking at either. To them both are a cinch.
  • HannoHanno Posts: 1,130
    edited 2009-07-01 13:06
    The Propeller will become much easier to use real soon- more will be revealed when it's ready....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Download a free trial of ViewPort- the premier visual debugger for the Propeller
    Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
  • PropellerFanPropellerFan Posts: 4
    edited 2009-07-01 13:14
    Hi Hanno,

    you made me so curious. Can you say a date ?
  • HannoHanno Posts: 1,130
    edited 2009-07-03 08:06
    "Spinner" is almost ready. Currently planning to initially release it as a free plugin to ViewPort Ultimate. Later might make it available as a standalone. Spinner makes the Propeller so easy to use that my daughter can use it.
    She's not quite 5.
    She can't read yet.
    Besides making the Propeller much easier to use, it'll also introduce a new programming style based on messages. Should make enough progress this weekend to show something early next week. Who wants to beta test?
    Hanno

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Download a free trial of ViewPort- the premier visual debugger for the Propeller
    Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
  • WhitWhit Posts: 4,191
    edited 2009-07-03 15:31
    Wow! Sounds very interesting Hanno. Hope you have a great weekend of progress.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2009-07-03 16:09
    Video, tile and sprite generation begin to draw you into a more complex programing world, but the BasicStamp doesn't do video. In sum, the Propeller can become a more complex subject; but it will teach you things that no other small microcontroller will explore. I tend to believe that some beginners should just jump into it as they will just rise to the challenge and never really understand why others feel it is hard. Hard for many learners define the topics they choose to avoid and easy are the ones they master. If you master all of them, everything is easy.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ain't gadetry a wonderful thing?

    aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan

    Post Edited (Loopy Byteloose) : 7/3/2009 4:15:11 PM GMT
  • localrogerlocalroger Posts: 3,452
    edited 2009-07-03 19:43
    I've been using Basic Stamps for years to do quick and dirty industrial controls (you'd be surprised how often something like that comes out useful, for example converting between incompatible serial protocols for two devices that aren't themselves programmable and don't speak the same language). There are a few things that are much easier for beginners in PBasic because of the built-in language support, such as PWM, serial comms (assuming you can deal with the inability to TX and RX at the same time, or to RX until you've issued the command), and in the more advanced BS's things like the IIC and X10 commands. The Stamps also speak 5V natively which is much more common in hobby controls, although that is in flux.

    The Prop makes you find an object for a lot of those things the BS's do natively and a lot of those objects have a much steeper learning curve than the BS's do ... but once you overcome it, you can do a LOT more with the prop, a lot more easily and a lot more flexibly. Personally, I think it really shows that the prop is the end result of what a BS user would get if he gave his blue-sky wish list to a genie as wish #2. (As for wish #1, I'd guess the blue skinned slave girl would be very impressed.)
  • TrapperBobTrapperBob Posts: 142
    edited 2009-07-03 20:55
    Hi Hanno,

    I'll volunteer to do beta testing for you

    TrapperBob
  • ProcessingData...ProcessingData... Posts: 208
    edited 2009-07-03 21:14
    I will beta test too! Sounds like a good program if a five year old can do it!-- ProccessingData...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Basic Stamp,···· Propeller,·· · SX,·· FUN!


    START:·
    >Proccessing Data. . . .··
    >Task Complete. . .·.
    >Saving Data. . . .
    >Entering SLEEP Mode. . . .
    >Signing OFF


    ·
  • WhitWhit Posts: 4,191
    edited 2009-07-05 02:22
    Hanno,

    Do we need View Port Ultimate to beta test "Spinner?"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • John AbshierJohn Abshier Posts: 1,116
    edited 2009-07-05 02:31
    I would like to beta test it with my 8 year old grandson.

    John Abshier
  • phil kennyphil kenny Posts: 233
    edited 2009-07-05 03:53
    I too, will be glad to do Beta testing. Running under Viewport Ultimate
    is not an issue for me.

    phil kenny

    Post Edited (phil kenny) : 7/5/2009 3:59:02 AM GMT
  • heaterheater Posts: 3,370
    edited 2009-07-05 04:22
    ProcessingData "I will beta test too! Sounds like a good program if a five year old can do it!"

    Don't be so sure. A five year old, and less, can break things in ways an adult could never dream of[noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Ole Man EarlOle Man Earl Posts: 262
    edited 2009-07-05 04:43
    How about an elder (translation 'Old') person for beta testing.
    We are retired and have the time !
    Earl
Sign In or Register to comment.