I found the Servo class for pyboard
http://docs.micropython.org/en/latest/p ... Servo.html
and I want to have the same functionality on STM32F407DISC board.
As I found out its written in C and only for the pyboard. Or is it not?
I have already played with PWM and I think a sort of "standard" servo class should be written in python as abstract to use it on any board. Or is the class Servo usable on any board?
I got nothing after importing pyb.Servo
AttributeError: 'module' object has no attribute 'Servo'
Is it because I did not make the upy firmware with the macro:
#define MICROPY_HW_ENABLE_SERVO (1)
in
micropython/stmhal/boards/STM32F4DISC/mpconfigboard.h
As it throw an error on making:
:micropython/stmhal$ make BOARD=STM32F4DISC
...
[code]
In file included from ../py/mpstate.h:35:0,
from modpyb.c:32:
modpyb.c:184:23: error: 'MP_QSTR_pwm' undeclared here (not in a function)
{ MP_OBJ_NEW_QSTR(MP_QSTR_pwm), (mp_obj_t)&pyb_pwm_set_obj },
^
../py/obj.h:91:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 2) | 2))
^
modpyb.c:185:23: error: 'MP_QSTR_servo' undeclared here (not in a function)
{ MP_OBJ_NEW_QSTR(MP_QSTR_servo), (mp_obj_t)&pyb_servo_set_obj },
^
../py/obj.h:91:56: note: in definition of macro 'MP_OBJ_NEW_QSTR'
#define MP_OBJ_NEW_QSTR(qst) ((mp_obj_t)((((mp_uint_t)(qst)) << 2) | 2))
^
../py/mkrules.mk:47: recipe for target 'build-STM32F4DISC/modpyb.o' failed
make: *** [build-STM32F4DISC/modpyb.o] Error 1
[/code]
Should I try to repair the error or should I write and contribute separate python Servo module?
Servo class on STM32F407 DISCOVERY
Re: Servo class on STM32F407 DISCOVERY
The qstr generator occasionally has problems. When you run into issues like the above, I normally do a clean: and then rebuild.
I was able to build the latest micropython setting #define MICROPY_HW_ENABLE_SERVO (1) and building.
Code: Select all
make BOARD=STM32F4DISC clean
I was able to build the latest micropython setting #define MICROPY_HW_ENABLE_SERVO (1) and building.