Asked
Could you explain how myfunc and return are used in Blockly. Can you give me a few examples of how they are being used in Blockly scripts. I would like to use them to oversee certain scenarios in the script, and if it does happen do something to correct it. Can you show me how to do this?
Related Hardware (view all EZB hardware)
EZ-B V4
by EZ-Robot
EZ-B v4/2 robot controller: dual Cortex ARM, Wi-Fi, audio/video, 24 servo/digital ports, I2C/UART, camera and Synthiam ARC control for custom robots
Wi-Fi / USB
Servos
24
Camera
Audio
UART
3
I2C
ADC
8
Digital
24
Related Robot Skills (view all robot skills)
User Defined Function Example
by Synthiam
Add custom EZ-Script functions in C# or JS; intercept unknown calls, parse parameters and return values via AdditionalFunctionEvent.
Requires ARC
v4
Script Collection
by Synthiam
Manage and execute multiple scripts in a single Script Manager using ControlCommand(), with Control Details showing available commands.
Touch Path
by Synthiam
Sketch paths with finger or mouse and set turn/move speeds; interactive, educational demo of timing-based, sensorless robot navigation and limits.

Maybe take a course? like this one: www.codecademy.com/learn/learn-to-code-with-blockly
Certainly! In Blockly, functions (referred to as "procedures" in some Blockly implementations) allow you to create reusable blocks of code. You can define a function to perform a specific task, and then you can call that function from different places in your program. This helps to organize your code and avoid repetition.
Here's a step-by-step guide on how to use functions in Blockly within Synthiam ARC:
Creating a Function:
myfunc.Defining the Function:
Returning a Value:
Calling the Function:
myfunc) into the desired place in your Blockly script.Using the Return Value:
Here's an example scenario using Blockly in Synthiam ARC:
Scenario: You want to create a function that checks if the robot's battery level is below a certain threshold and returns
trueif the battery is low.checkBattery.checkBattery, use the blocks to get the battery level and compare it to the threshold.true; otherwise, returnfalse.checkBattery.checkBatteryreturnstrueand, if so, perform an action like sending a warning message or navigating the robot to a charging station.Remember, the exact blocks and categories may vary depending on the version of Blockly and the specific implementation in Synthiam ARC. If you need more detailed instructions or if there are specific blocks you're looking for, please let me know, and I can provide more tailored guidance.
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
Looked into the site and I may just do that. I find that ARC is nice because it can bounce back and forth between Blockly and Javascript to see what code has been generated which is what I should done before even this question, but forgot.
Saw a 5 min video on functions on YouTube and fully understand it. I think this will come in handy for the overseeing question that I asked Athena about. This is like a mini program that can be called upon to check the scenario. It would be nice if this mini program could be individually copied and pasted on the side of an existing Blockly program. Maybe it's already been done just don't know how to do it.