Replies: 2 comments 1 reply
-
|
Your code seems to attempt to read RGB and then convert them to HSV. But the sensor gives HSV, not RGB. So this code: try:
r, g, b = sensor.rgb() # 0..100 each
return rgb_to_hsv_deg(r, g, b)
except Exception:
return NoneWill find that there isn't an When working on a project like this, I recommend taking smaller steps and testing as you go. So perhaps you could start with smaller programs to experiment with:
|
Beta Was this translation helpful? Give feedback.
-
|
Small thing next to the solid advice from Laurens: Something like: hub.system.set_stop_button(None) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there! I could use some guidance and help. I'm new to Python and Spike Prime and aren't even sure I'm going in the right direction.
I have been trying to use a color sensor to select which program to call while maintaining the ability to manually select a program on the hub. For example, if the color green is detected, then a "1" appears on the hub, and program 1 plays once the center hub button is pressed. The hub display can also be overridden, and other programs selected regardless of what color is detected. Since different people are working on various programs, I do not want to combine everything in a single program. I'd like to have a menu that compiles it together.
I can get the numbers to appear on the hub, but it does not execute the related program. All programs are currently songs/beeps, but none of them play through the menu. They play stand-alone when I test them independently, but the menu doesn't seem to import them.
Is what I am attempting possible on Pybricks? If so, what is going wrong with my attempt?
Thanks in advance for your help.
Below is what was coded.
Beta Was this translation helpful? Give feedback.
All reactions