Blockly for Picaxe

stevesmythe

Senior Member
I've just spotted some new things on the Rev Ed website - Cloud Programming and Blockly for Picaxe (within PE6 Editor). For those who haven't heard of it, Blockly is a block programming language similar to Scratch.

The Help system alludes to a Picaxe Manual 5 for Blockly (which is only a placeholder).

Hopefully, a manual will appear shortly?
 

stevesmythe

Senior Member
I think there might be a bug with the AXE023 block (I've only tried the PE6 version). The middle row, I guess, is to turn both motors in either direction or stop. This seems to work. However the top and bottom rows don't seem to work properly (only one of the possible 9 tick positions controls the "right" motor).

If it's not a bug then please explain how it is supposed to work.
 

Technical

Technical Support
Staff member
Seems to work ok for us, generating patterns for C.0, C.1, C.2 and C.4 (correct pins for the AXE023).
Make sure you are moving the output0 jumper when testing :)

If you want to see the BASIC generated via Blockly go to File>Options>Diagnostics and then display the BASIC tab.
 

stevesmythe

Senior Member
Yes, if you generate the BASIC first, it works OK. Maybe I'm using it wrongly. When I click the Program button from the Blockly screen, I get different results.
 

stevesmythe

Senior Member
OK, I see what's happening. I had the power supply switched off on some occasions and I didn't notice because the compiler still compiled the blocks and there wasn't the usual error message about not finding the COM port.
 

stevesmythe

Senior Member
It might be "fairly intuitive" but the Tune block has me beaten. It says "right click to run wizard" but I can't get any wizard to run that way. However, if I use the PE6 Tune Wizard separately and paste the result into the Basic block, I get a working Tune Block! Very odd...
 

Circuit

Senior Member
I have been programming in PICAXE Basic for several years and very successfully. Thought that I would try out Blockly and, quite simply, what fun it is! It is a superb method of programming in an easy to read, graphical manner - and very clever in that it will translate the output into standard PICAXE Basic. I found that I rather enjoyed it. Will it replace standard programming for me? well, no it won't of course, but it is so easy to use that I shall certainly be using it for some programs even if it is just for the fun in using it. Well done, RevEd, yet another masterful piece of software. Now, for heaven's sake, get on and announce the thing clearly! It is jolly excellent!
 

stevesmythe

Senior Member
Yes, I echo what you say Circuit.

My seven year-old is a whizz with block programming languages like Scratch and MIT App Inventor but he gets a bit discouraged trying to remember all the Picaxe Basic commands (and parameters). Blockly for Picaxe not only makes that easy (and takes care of the correct syntax), but the generated Basic also helps him to improve his Picaxe Basic coding.
 
Blockly looks great for quick experiments and simple stuff, very cool that it can display the basic - would it be possible to go the other way, start in basic and have Blockly display it? Could be handy?
 

Technical

Technical Support
Staff member
It might be "fairly intuitive" but the Tune block has me beaten. It says "right click to run wizard" but I can't get any wizard to run that way. However, if I use the PE6 Tune Wizard separately and paste the result into the Basic block, I get a working Tune Block! Very odd...
You should see a 'run wizard' menu when right clicking over Tune.
CaptureWizard.PNG
 

Technical

Technical Support
Staff member
Blockly looks great for quick experiments and simple stuff, very cool that it can display the basic - would it be possible to go the other way, start in basic and have Blockly display it? Could be handy?
Both Blockly and flowcharts are a smaller 'subset' of what you can achieve in BASIC, so it is not possible to convert in the reverse direction.
 

Technical

Technical Support
Staff member
OK thanks, we'll look into that. A new update will be out shortly that will probably fix that.
 
Last edited:

Circuit

Senior Member
@Technical; another fix required; when I type into some of the text boxes to rename a variable, certain characters behave as a hotkey and invoke a menu (file save etc.,) rather than placing the typed character into the variable text box.
 

jims

Senior Member
Technical...this is probably like post #16. Found that when try to input into a text block; if first letter is "s" the "save" dialog box opens. JimS
 

hippy

Technical Support
Staff member
@ Circuit, jims : We'll investigate those as well. Thanks for the feedback.
 

Technical

Technical Support
Staff member
Please try 6.0.8.2 where we have updated the Blockly core to the 1.0.3 release. It may be beneficial to restart the computer after doing the update to clear any caches.
 

jims

Senior Member
Enjoying the process of learning Blockly. It is very intuitive. A feature that would help me is to be able to send a message that will print both an Ascii string and the value of a variable. eg: ("Temp is: ",#var). I now do it by writing the code in the "Basic" feature. This is something that I use often, and it would be handy to have the function in Blockly.JimS
 

hippy

Technical Support
Staff member
The serial and LCD blocks will automatically handle text and variables depending on whether a message or variable is tagged on to them.

For most users at the level Blockly is aimed at the solution would be to print the output over two lines using two Blockly LCD or serial output commands.
 

jims

Senior Member
The serial and LCD blocks will automatically handle text and variables depending on whether a message or variable is tagged on to them.

For most users at the level Blockly is aimed at the solution would be to print the output over two lines using two Blockly LCD or serial output commands.
Good point Hippy...I was thinking it would show beginners that it's possible to combine text and variables in the same message. Jims
 

stevesmythe

Senior Member
Enjoying the process of learning Blockly. It is very intuitive. A feature that would help me is to be able to send a message that will print both an Ascii string and the value of a variable. eg: ("Temp is: ",#var). I now do it by writing the code in the "Basic" feature. This is something that I use often, and it would be handy to have the function in Blockly.JimS
Here's how I did it Jims. Self explanatory I hope.

blockly test.jpg
 

stevesmythe

Senior Member
I don't really think that the Servo blocks are very intuitive either. It would be good to have some sort of explanation of what sort of use the "offset" is intended for.

In any case, I think there's a bug on Servo A. If I convert the blocks below
blockly servo test.jpg
to Basic, then the code generated is:
Code:
'
'Converted  2015-09-23 at 14:25:17

main:
#IFNDEF servo_motors_defined
#DEFINE servo_motors_defined
	symbol SMA_pin = B.0
	symbol SMA_stop = 99
	symbol SMA_speed = 66
	symbol SMA_forward = SMA_stop - SMA_speed
	symbol SMA_back = SMA_stop + SMA_speed
	symbol SMB_pin = B.0
	symbol SMB_stop = 77
	symbol SMB_speed = 66
	symbol SMB_forward = SMB_stop + SMB_speed
	symbol SMB_back = SMB_stop - SMB_speed
	servo SMA_pin, SMA_stop
	servo SMB_pin, SMB_stop
#ENDIF
#IFNDEF servo_motors_defined
#ERROR You must use a 'servo motor setup' command first!
#ENDIF
	servopos SMA_pin, SMA_back : servopos SMB_pin, SMB_forward
#IFNDEF servo_motors_defined
#ERROR You must use a 'servo motor setup' command first!
#ENDIF
	servopos SMA_pin, SMA_stop : servopos SMB_pin, SMB_stop
#IFNDEF servo_motors_defined
#ERROR You must use a 'servo motor setup' command first!
#ENDIF
	servopos SMA_pin, SMA_forward : servopos SMB_pin, SMB_back
	stop
"symbol SMA_speed = 66" should be "symbol SMA_speed = 88", I think. And why is it "speed" anyway? Very confusing.
 

Technical

Technical Support
Staff member
Are you trying to use a 'servo' or 'servo motor pair' (continuous rotation servo pair).

We suspect the first, in which case you should be using the servo command from the top Outputs menu instead
 

stevesmythe

Senior Member
Are you trying to use a 'servo' or 'servo motor pair' (continuous rotation servo pair).

We suspect the first, in which case you should be using the servo command from the top Outputs menu instead
Ah, yes, you're right. So, what's the Blockly equivalent for servopos b.0, position, please?

PS There's still a bug in the "servo motor pair" block, though, I think.
 

Technical

Technical Support
Staff member
Yes, there is a value duplication bug for that pair that we have just fixed.

Servopos is included in Blockly but is not currently visible, in a future release you will be able to decide which commands to show/hide in each section of the toolbox.

For now you can still use a BASIC block.
 

pearcehw

New Member
Hi All - these posts are from 2015 w.r.t. Blockly & Picaxe Cloud Computing.
I've only recently started using the web link (www.picaxecloud.com) to Picaxe Cloud,
creating projects and working through the 'Manual 5': A guide to using Blockly.....
My question is: While it is easy to create new projects, with menu options using: New, Save & Save As,
there are no Delete options for removing projects. How does one delete projects in Picaxe Cloud?
 
Top