I’m wondering if I can input a joystick into the receiver module. And how its GPIO pins are mapped.
Stock no, you can’t add inputs to the receiver, only outputs in the form of motors, servos, and lights
I wasn’t sure but yea. Oh and btw, I’m writing my own code, I’m not using the original cyberbrick code and I was trying to figure out what pins go to where. Servos are 0, 1, 2 and 3. The motors are 4, 5, 6 and 7. But I can’t figure out what pins control the leds.
And now I think about it, I at the very least must be able to turn it into a digital input, no? It uses the same board as the controller which uses all pins as input. Unless there’s harware on the receiver part that’s specific for outputting…
This information may assist.
https://github-wiki-see.page/m/rotorman/CyberBrick_ESPNOW/wiki/CyberBrick-Receiver-Shield-(X11)
That helps a lot, thanks! I tried my code to control the onboard led on the array, but that doesn’t seem to work. How do I control the led array?
If you mean the two led hubs, this does that.
Any number above zero means illuminate that colour channel with that amount of brightness, any with zero means no brightness to that colour.
If you mean the onboard led.
import machine
import neopixel
import timepin = machine.Pin(8, machine.Pin.OUT)
np = neopixel.NeoPixel(pin, 1)np[0] = (255, 0, 0) #(R, G, B)
np.write()
To make one white: 255,255,255 or black: 0,0,0. Colours are in the order of red, green and blue.
There’s actually a lot of unused capabilities on the chips used for CyberBrick. If you want to see the kinds of things they can do, check these out. There’s lots of programming examples in Python for it and technical information. The photo of the Cyberbrick board is difficult to make out the markings so this might not be identical but if not, it’s probably very close.
It would be interesting to know if the Adafruit tools and libraries would transfer because it could allow all sorts of accessories, sensors, and even displays of various kinds could be added. Similarly, it could be the Adafruit boards could just be swapped in and Cyberbrick tools used too.
I had tried this already but it doesn’t work for me for some reason
In what way doesn’t it work?
- Doesn’t show the colours selected?
- Doesn’t show anything?
- Lights rotate through unselected colours?
- An error code is presented?
Are you pasting it into the code section of the UI?
Are you then assigning that named code section to an input like a button?
Are you able to test the code using the UI test button?
Are you sending the config to the devices?
Sry wait I’m not using code snippets, I’m writing code straight to the board. None of the leds light up.
I didn’t see anything in your posts saying you have erased the boards or changed the firmware.
If you are using them as CyberBrick boards, the UI and my code works perfectly together.
If you have abandoned the CyberBrick system, my CyberBrick compatible code will not work as it is dependent on the libraries being available on the boards as part of the compile process.
I said it here but i shouldve made myself more clear.
I didn’t change the firmware, and i can control the motors and onboard LED, haven’t tried the servos yet. So i should be able to still use these libraries no?
Without knowing what you are doing or how, I have no idea.
This doesn’t say what you are doing, just that you are not using CyberBrick supplied code, like their example code, it doesn’t say you have abandoned or to what degree the CyberBrick solution.
You need to provide much more with descriptions and likely screenshots
We can’t peer into your kind.
I’m saying this only from my own experience in programming and not from Cyberbrick experience. In general you shouldn’t have problems but if two libraries are accessing the same hardware registers you could have issues especially if one library initializes something as an output and another initializes as input. They would be setting bits in the same direction registers and could step on each other with the last initialization being the configuration that “sticks”.
Most devices let you set directions of ports individually but it could be these guys just say everything is output or everything is input depending on the role of the board. It would take examining the code or documentation or some experimentation to know what they are doing and if that is what keeps lines from being used as input.
Or this could be bogus for these devices and the software libraries they supply. But trying to teach people how to code isn’t easy especially when you start breaking ports into individual bits with some input and some output. Instead, they could just make everything an input on the controller role and everything output on the remote device. But it all depends on the design philosophy they chose for how to use these devices.
I took the cyberbrick boards, deleted all of the existing files using arduino lab for micropython. Then, to try to figure out how to control the LEDs, I first tried to run the code i used to get the onboard led working from inside arduino lab. Which didn’t work, then I renamed the file main.py and wrote it onto the board (i have checked and it automatically runs main.py and boot.py). Which also did not work.
If I understand you correctly you deleted all the code that CyberBrick requires and are now confused why the code you provided that relies on it doesn’t work.
Why did you delete the CyberBrick code on the hardware and then tried to use CyberBrick code?
Sorry, I am very confused as to why you chose CyberBrick that provides a walled garden to make things easy and then stripped all of that off to return them to base Arduino boards?
Why didn’t you just buy Arduino boards and related parts to make your own solution?
Neither a CyberBrick solution without the CyberBrick sub-system or Arduino boards can be uploaded as CyberBrick compatible models in the MakerWorld system.
That’s an excellent point about leaving the Bambu development environment for others. Designers will be taking themselves out of the Cyberbrick world as well as adding complexity for those who are interested in their models. The designer also sets themself up to be technical support for a somewhat complex non-standard code implementation if people run into trouble.
For those who want to do Cyberbrick models, any special functionality may need to be in-line in the code where it stands alone and can be used in the Cyberbrick environment. In effect the designer will be writing their own libraries.
Coding for microcontrollers isn’t all that hard but folks can find themselves having to decipher microcontroller data sheets to configure functionality. It can involve bit masking and other stuff which is part of why libraries exist besides just writing code once.
The counterpoint is all the control and capability you get over and above what the library writers may provide.
The cyberbrick system just does not have enough freedom for what I am making, unless i don’t understand correctly, there are no variables and custom code only runs after the user gives some input. I need to do things like count button presses if some other requirement is met. I know what I am doing is not fully integrated with the cyberbrick eco-system but it still uses the same hardware and is quite easy to set up and even go back to the original cyberbrick code.
I also have tried adding on my own code inbetween the cyberbrick original code but that just didn’t work…