Python PwmOut not working

I am currently trying to code a Pwm Out device using the VSCode extension. When I run the code I get this error…

Traceback (most recent call last):
  File "userpy", line 41, in <module>
NameError: name not defined

This line 41 in my code

ledOne = PwmOut(brain.three_wire_port.h)

The RobotMesh documentation says this is the correct way to delacre the object.

It may be correct for RobotMesh but you are using the VEX VS Code extension not RobotMesh, so that API is not applicable, the correct form would be.

ledOne = Pwm(brain.three_wire_port.h)

if your plan is to drive a LED driven by MC29 motor controller, I thought that had been determined to be not competition legal.

6 Likes

Thanks for your help! I only could find a python documentation for robotmesh, does documentation exist for vex python? If so how can I access it?

There’s nothing online, however, if the Microsoft Python and Pylance extensions are installed, you will get pretty good intellisense, just start typing something close and help will show.

There’s also a certain amount of help builtin (from VEXcode), use the command palette.

5 Likes