Open Propeller Project #5: MIT's Scratch and Propeller Multicore

2

Comments

  • RaymanRayman Posts: 9,651
    edited 2014-04-01 - 06:15:15
    The arduino version is very interesting. Actually, another approach to this might be to modify the generator to make GCC compatible C++ code. JavaScript is so close to C++, it might be easier than generating Spin. Also, the final code could be cleaner looking by including Simpletools.h or something...

    But, I'm going to stick with Spin for the moment. I think Spin is slightly easier to understand than C++, and since this would be a ground zero learning tool, maybe that's better...
    Prop Info and Apps: http://www.rayslogic.com/
  • Heater.Heater. Posts: 21,213
    edited 2014-04-01 - 07:20:23
    Rayman,
    JavaScript is so close to C++,
    Ouch! Only if you don't talk about JavaScript's interesting features like: dynamic typing, first class functions, closures, lambdas, nested functions, prototypical inheritance, varadic functions, etc etc a lot of which are features that C++ is only just beginning to adopt in it's latest standards.
    Spin is slightly easier to understand than C++
    That might be the understatement of the year so far! I don't believe it is possible for a single human being to understand the infinite fractal complexity of the C++ monster.

    Having said all that, I have no idea about blockly. Does it let yo use the full features of the languages it generates code for or is it enforcing it's own "syntax" and semantics on things?

    For example in JS I can have an array like [42, 93, "Wednesday", someObject, 1000, someFunction, 666].

    Clearly a jumble of types in an array like that cannot happen in C++ unless you define some variant base class to contain them all.
  • RaymanRayman Posts: 9,651
    edited 2014-04-01 - 09:57:39
    The BlockyDuino is proving very useful for showing how to hack into Blockly and add special things...
    Also, I'll probably copy the way they handle strings...
    Prop Info and Apps: http://www.rayslogic.com/
  • RaymanRayman Posts: 9,651
    edited 2014-04-02 - 12:48:24
    So, I've figured out enough to make it generate actual Spin code :)
    Try this out:
    http://www.rayslogic.com/Propeller/Programming/Blockly/Test2/BlocklyTest2.htm

    If you make this:
    test2.png
    and push the "Generate Code" button,
    you should get this:
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    OBJ
      ser:  "fullduplexserial"
     
    
    PUB Main
    ser.start(31,30,0,9600) 'start serial comms
    repeat 100
      ser.tx(string("Hello",13))
    
    263 x 157 - 4K
    Prop Info and Apps: http://www.rayslogic.com/
  • jazzedjazzed Posts: 11,803
    edited 2014-04-02 - 12:55:11
    Good job.

    Maybe it wasn't "super easy", but you're getting there ;-)
    Rayman wrote: »
    So, I've figured out enough to make it generate actual Spin code :)
    Try this out:
    http://www.rayslogic.com/Propeller/Programming/Blockly/Test2/BlocklyTest2.htm

    If you make this:
    test2.png
    and push the "Generate Code" button,
    you should get this:
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    OBJ
      ser:  "fullduplexserial"
     
    
    PUB Main
    ser.start(31,30,0,9600) 'start serial comms
    repeat 100
      ser.tx(string("Hello",13))
    
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-04-02 - 13:25:33
    Rayman wrote: »
    So, I've figured out enough to make it generate actual Spin code :)
    Try this out:
    http://www.rayslogic.com/Propeller/Programming/Blockly/Test2/BlocklyTest2.htm

    If you make this:
    test2.png
    and push the "Generate Code" button,
    you should get this:
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    OBJ
      ser:  "fullduplexserial"
     
    
    PUB Main
    ser.start(31,30,0,9600) 'start serial comms
    repeat 100
      ser.tx(string("Hello",13))
    

    Way cool!!! Totally brilliant!

    Only problem is it has to be ser.str for it to send the string.

    and if you have an embeded ' in the string, it escapes it to a \' which Spin takes literally.

    I generated it, cut and pasted into PropellerIDE and it ran just fine!!

    Well done, Rayman!!
    MOV OUTA, PEACE <div>Rick </div><div>"I've stopped using programming languages with Garbage Collection, they keep deleting my source code!!"</div>
  • RaymanRayman Posts: 9,651
    edited 2014-04-02 - 13:27:23
    I guess I should have actually tried the code before posting...
    Thanks for catching that so fast! I'll fix it now...

    Ok, I think it's fixed...
    Prop Info and Apps: http://www.rayslogic.com/
  • Heater.Heater. Posts: 21,213
    edited 2014-04-02 - 13:27:29
    Ray,

    That is cool. I have no idea what one would do with it but I'm impressed.
  • RaymanRayman Posts: 9,651
    edited 2014-04-02 - 13:37:00
    Well, I think it's something that second graders might be able to do...

    You barely need to type and you could make a servo move or LED blink or something like that...
    Prop Info and Apps: http://www.rayslogic.com/
  • Heater.Heater. Posts: 21,213
    edited 2014-04-02 - 13:40:42
    Ray,

    Yes I agree. I'm all for it. It's just that the Espruino (JavaScript) and Arduino(C++ I guess) and others can do that already and cheaper. How can we show off the Propeller capabilities with this?
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-04-02 - 13:51:53
    Heater. wrote: »
    Ray,

    Yes I agree. I'm all for it. It's just that the Espruino (JavaScript) and Arduino(C++ I guess) and others can do that already and cheaper. How can we show off the Propeller capabilities with this?

    You remove the "generated code" visibility and directly ship the output of the generator to a compiler and then a loader and you've just blinked or moved. OK, yes, there is Blocky for other controllers which make the Propeller a me too device with a dev board stuck out there. How many grade schoolers (second graders) are going to be plugging a circuit together with a breadboard and components? What you need is something interesting and rugged and grade appropriate plugged in at the other end of the cable.

    A small animatronic bear, doll, etc.
    A robot
    An electronics "playground" with LEDs, servo/motor driven merry-go-rounds, a servo driven teeter-totter, a speaker (kids like noisy things), more LEDs, etc.

    That's the tricky part, finding something engaging for the 2nd graders mind that also give programmable peripheral learning opportunities.

    Stuff like that until they are ready for a P2 Liquid cooled super turbo development board! :smile:
    MOV OUTA, PEACE <div>Rick </div><div>"I've stopped using programming languages with Garbage Collection, they keep deleting my source code!!"</div>
  • Roy ElthamRoy Eltham Posts: 2,651
    edited 2014-04-02 - 14:01:54
    Heater,
    By adding blocks that let you do more propeller-y things.
    And maybe allow multiple block chains to be part of the same "program" and they each run in a different cog.
  • Heater.Heater. Posts: 21,213
    edited 2014-04-02 - 14:08:34
    Roy,
    And maybe allow multiple block chains to be part of the same "program" and they each run in a different cog.
    That sounds like the ticket.

    @mindrobots,

    Remind me again what actual age is a "second grader" in the Sates? So I know what we are talking about.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-04-02 - 14:24:57
    7 - 8 barring special cases.
    MOV OUTA, PEACE <div>Rick </div><div>"I've stopped using programming languages with Garbage Collection, they keep deleting my source code!!"</div>
  • Heater.Heater. Posts: 21,213
    edited 2014-04-02 - 14:47:22
    OK, Thanks,

    Here is what one young girl who has been studying such things found about teaching programming to young children:
    http://www.youtube.com/watch?v=aiFOurKwy7M
  • RaymanRayman Posts: 9,651
    edited 2014-04-02 - 18:00:52
    Check this out at code.org:
    http://learn.code.org/hoc/1

    This appears to be Blockly and I see the name Blockly in the page source code.
    But, no mention of Blockly anywhere... Strange...
    Prop Info and Apps: http://www.rayslogic.com/
  • RaymanRayman Posts: 9,651
    edited 2015-09-23 - 18:57:58
    Was just looking at this again...

    Noticed "Extensions" for Scratch 2.0 (in offline mode) that would let you interact with Propeller.
    Looks like most people are programming extensions in Python, which is great, except that I don't know how to code in Python.

    There's also a helper Python library called BlockExt to help creating custom blocks.

    There's also Snap!, very similar to Scratch, that these extensions should work with.

    I see extensions for Arduino that may be easily modified by someone who is good with Python.

    I found extensions that said they were for the Parallax S2 Scribbler robot. But, this turned out to actually be for a board that plugs into S2 and adds camera and bluetooth, not for Propeller...

    I may try to hack the Arduino code, but I"m sure somebody who know what they were doing could make this happen a lot faster...
    Prop Info and Apps: http://www.rayslogic.com/
  • Actually, maybe ScratchX is easier... Those extensions are in Javascript, which I'm more familiar with... Also, it looks a lot simpler all around...
    Prop Info and Apps: http://www.rayslogic.com/
  • Just bringing you current on where we've been on this project. Today we have a working Blockly server http://blockly.parallax.com. The blocks are being defined and created, but there are enough to see that you can generate code, program and download.

    Ken Gracey
  • Could you somehow make it automagically figure out the stack size for cognew?
  • Pretty neat, Ken! Reminds me of Hanno's 12Blocks program

    I see S3 in the board drop down menu, when do we get to play with that? :)
    Infernal Machine
  • Looks great.
    Prop Info and Apps: http://www.rayslogic.com/
  • I think my kids are going to like this site. They like MIT's Scratch and now they need to know about this site!

    Mekkatronix@yahoo.com
  • Looks great. Finding a few issues still but love the progress so far :)
    David
    PropWare: C++ HAL (Hardware Abstraction Layer) for PropGCC; Robust build system using CMake; Integrated Simple Library, libpropeller, and libPropelleruino (Arduino port); Instructions for Eclipse and JetBrain's CLion; Example projects; Doxygen documentation
    CI Server: https://ci.zemon.name?guest=1
  • Very nice! Looks like C is more usable at this point, as I found several issues with Spin code.
    Livermore, CA (50 miles SE of San Francisco)
  • Yeah, just use the C code generator for now - don't bother with Spin in this case. We've got better library support for the simple stuff with C.

    You're all welcome to post any findings here. It's not going to be all that useful just yet since there are so many obvious fixes that there's little sense in bug-hunts.

    We're reviewing our Blockly language definition on Monday. After that we'll be making high-speed progress towards a full Blockly multicore implementation!

    Ken Gracey
  • Ken Gracey wrote: »
    Yeah, just use the C code generator for now - don't bother with Spin in this case. We've got better library support for the simple stuff with C.

    Sounds good!

    dgately
    Livermore, CA (50 miles SE of San Francisco)
  • Bump

    Does anyone know how to get this working in Scratch itself, or at least get the icons more colorful?

    We are starting to get a lot more demand right now for K-5 after school classes. These are public school kids at the end of their day, tired, their attention span vanished around 2 hours ago, etc. The Blockly color palette is much less engaging than Scratch (we've tested it) and I also like the idea of possibly incorporating stuff on that Canvas area while the robot is moving.
    Founder of Kinvert
    https://www.kinvert.com/
  • Keith,

    You're asking if it is possible to change the BlocklyProp colors to something like used in Scratch? It is possible to do this but Parallax presently has no interest in doing that in consideration of the number of projects we've already published with the current color scheme.

    You may be using BlocklyProp with a very young audience. Are you?

    Ken Gracey
  • Ken Gracey wrote: »
    Keith,

    You're asking if it is possible to change the BlocklyProp colors to something like used in Scratch? It is possible to do this but Parallax presently has no interest in doing that in consideration of the number of projects we've already published with the current color scheme.

    You may be using BlocklyProp with a very young audience. Are you?

    Ken Gracey

    The ability to change the BlocklyProp color scheme is a desirable feature. While experimenting with BlocklyProp recently, my wife (who is also a multi-lingual/environment programmer) commented that the current BlocklyProp color scheme is a bit too harsh to be sitting in front-of for long periods of time. Color schemes are always subjective and every user has their preferences. Giving BlocklyProp the ability to have even a limited set of Color schemes would go a long way to pleasing a wider audience. Documentation could still use the default Color scheme for consistancy, which is what other environments do.
    Along with 'Antimatter' and 'Dark Matter' we've recently discovered the existence of
    `Doesn't Matter`, which appears to have no effect on the universe whatsoever.
Sign In or Register to comment.