2025-11-10 1:09 AM
2025-11-10 1:54 AM
Does MCSDK supported the code generation for 2 motors, or you are implementing on your own? Probably if you are implementing on your own better to look at the code MCSDK is generating for 2 motors, i think it is supporting some series of micro and boards for dual motor configuration.
Generate Code with Dual Motor on MC WorkBench - STMicroelectronics Community
2025-11-10 2:09 AM
2025-11-10 2:52 AM
I managed to get it working with the following code:
if (pHandle->H1Pin == 8){
rotation_count_M1 -= pHandle->Direction * SenseMoteurM1;
}It does the job, but I don’t find it very clean.
I would have preferred to use something like a symbolic name (e.g. M1) instead of hardcoding the GPIO pin number.
If anyone knows a better way to identify the motor or Hall sensor instance without relying on the pin number, I’d really appreciate your input!