pybricks / support

Pybricks support and general discussion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] Is there any function can directly contorl the PWM of each port?

a10036gt opened this issue · comments

Is it possible to implement a "pwm" method to drive the pin 1 and 2?

Not like the motor.dc() command, I want to build a custom sensor but I want using the pwm power at P1 P2 at same time, but due to Auto ID Check function, I can't use motor.dc() command and PUPDevice command at same time, is there any solution?

Thanks!

Are you emulating the Powered Up protocol on your other device?

Yes I emulating the Powered Up protocol on arduino and STM8.

What do you want to hook the motor outputs up to? These pins are connected to a motor driver chip, so you have to take into account those electronics in what you are connecting it to.

That's because we want to using the PWM power (battery power) to driving some heavy load parts, like Pixy 2 Camera or something like that. Because 3v3 may not have that high current to push these devices.

Like SPIKE Ultrasonic and Color sensor, their LEDs is actually powered by P1 P2 100% PWM.

It isn't actually possible to turn on both outputs at the same time. This is the table from the motor driver datasheet.

image

The LEGO sensors/lights will bring either P1 or P2 high, but not both at the same time.

If you are using the LEGO UART protocol, then you can set the appropriate flag for the pin you want to use for power in the extended info that is embedded in INFO_NAME. See https://github.com/pybricks/technical-info/blob/master/uart-protocol.md#info_name

image

Oh I didn't noticed that appropriate flag before, my bad, I will try to add that into my code, thank you so much!