Hello. If you need, i have included my code for the Skid Steer / Skid Loader - Cyber Brick - Free 3D Print Model - MakerWorld cyberbrick model (you can c/p all italics to find the files). Hope it helps!
I started with your Skid Steer code and that worked wonderfully. However, I’m trying to make a simple autonomous program to get my skid steer to drive a pre-set route. What I want is to be able to press the shoulder button and it run a pre-set program. In “CODE” I made a python snippet and called it “Auto”. Then I set the “L shoulder button” to run the code when pressed but nothing happens. Here is the code I put in. Anyone had any luck making a script that will run when a button is pushed?
This is my test scrip just to make it drive forward and backward for 5 seconds each in a loop. What am I missing?
**import MotorsController
import time
motors = MotorsController()
while True:
motors.set_rate(1, 50)
motors.set_rate(2, -50)
time.sleep(5)
motors.set_rate(1, -50)
motors.set_rate(2, 50)
time.sleep(5)**
The “**” shouldn’t be there.
import MotorsController
import time
motors = MotorsController()
while True:
motors.set_rate(1, 50)
motors.set_rate(2, -50)
time.sleep(5)
motors.set_rate(1, -50)
motors.set_rate(2, 50)
time.sleep(5)
Well this code is not valid Python as it needs leading whitespace.
Not sure what you mean but I did get this code to work:
motors = MotorsController()
Forward for 5 seconds
motors.set_rate(1, 50)
motors.set_rate(2, -50)
time.sleep(5)
Backward for 5 seconds
motors.set_rate(1, -50)
motors.set_rate(2, 50)
time.sleep(5)
However, I can’t seem to get it to loop using “while True:”
Try adding blank space at the beginning of each line within the while True: loop.
let’s try the socratic method
while means you want the machine to repeat the statements following untl some condition becomes true. while truetherefore means repeat forever, since true is always true.
Now how many statements are to be repeated? When I say “repeat the following…” you as an organic life form can tell when i am going back to regular speech and where the list of tasks ends.
How does the computer know?
What is the purpose of the spaces at the start of certain lines in Python?
As you think about this, you should figure out the answer to what you need to do.
I downloaded the Skid Steer / Skid Loader configuration, but the CODE section is blank. What am I missing?
When CyberBrick first came out I tried to get it to work and gave up in frustration. However, the fact that it uses Python inspired me to learn Python. I don’t know if they worked out the bugs or something, but when I returned to CyberBricks recently, everything seems to work as intended - with limitations of course.
The coding is rather limited and if one wants to have their models published on MakerWorld, one has to stick to the official configuration.
It seems to me that there are no global variables or commands, and except for the LEDs, nothing persists beyond the current event. You can’t just turn on a motor, you have to actively press a joystick to make the motors run. Servos return to their home position when the joystick is released. There are five custom modules which can be found here: CyberBrick Custom Libraries — MicroPython for CyberBrick V01.00.00.03 documentation
rc_module
LEDController
ServosController
MotorsController
BuzzerController
Using these one can do all the available functions. I’m not sure about the pushrod, but I think it can be controlled as if it is a servo. I don’t know what the BuzzerController is used for, but it does allow one to program a PWM signal. The intended use may be for creating vintage-video-game style music and sounds. However, since the signal can be manipulated, it’s use can be used creatively for other things.
Thank you, I appreciate the response, even though I wish it were better news. At least it confirms what I’m finding. I don’t think I want to load up a full IDE just for this. I hoped Bambu’s tools would be more useful, but if they don’t share details, they’re impossible to use.
@LarGriff @3dEd If you know Python and want to use it on this hardware, I’d recommend refering to the work referenced here:
The github files by @xrk work well and essentially give you the freedom to use full Micropython, including most of the Cyberbrick libraries without the limitation of the ‘easy to use’ interface forced on you by the pure Cyberbrick infrastructure. If you want to use the Cyberbrick Remote hardware, just stick to the basic SW in the repository. It has grown substantially to support std RC remotes and controls which, IMO, overcomplicates a Cyberbrick implementation.