Please, can anyone tell me what the lower level code is below this ts program that controls the wheels of this Mecanum Yahboom Omnibit car? I would like to apply this code to other motors driving larger mecanum wheels with a wifi module. Lines 86 to 108: Thanks, I assume there is some lower level code going on in the background.
look at CarDrift or CarRun function. It initialises the PCA9685, then initiates motor actions using MotorRun()
If you then look at MotorRun(), you can see it just does PWM actions… so it’s just driving thru PWM
I searched “initialises the PCA9685” and that led me to references to Adafruit Circuit Python library for motors. So is the answer to my question that there is Python running below the ts code or is this not the case? I don’t have any knowledge of any of this except that MakeCode is based, somehow, on typescript. I’m just trying to understand the structure of this programming: https://circuitpython.readthedocs.io/projects/pca9685/en/latest/api.html
I don’t think that’s even part of the solution, no.
There is a block of code that initialises the PCA9685 in the code section you sent me. It sets a particular mode and frequency. From there, the Motor actions simply set different PWM settings thru the PCA9685.
That’s how this code works. That’s how it controls the specific hardware.
Also, to clear up confusion, your reference to lines 86-108 in the source you referred to, that is simply an ENUM. An Enumeration is simply a mapping of friendly names to integer values, so that in your code you can say “Forward” and mean a specific value. It’s just a text-to-number map, there’s nothing fancy behind the scenes.
Can I assume you have the additional motors you’re talking about? Remember that the code you referred to is only relevant to a specific car platform, it’s not generally going to work unless you replicate that platform. So unless your new motors (or their controller) use PWM and are connected to a PCA9685, the code you show is good as an idea of the constructs of how to control the higher level functions but likely not relevant to the lower level.