-1

I have to use pigpiod, pi.hardware_PWM() as it gives me beautiful squrewave. I've created a webserver, in which I use flask and flask-wtf. I fetch the number from the user with IntegerField, which I would like to use as a PWM control number.

However I get an error message:

error: cannot convert argument to integer extents = [struct.pack("I", PWMduty)]

I tried to make the number an integer with int(variable name), but this gives an error message as well.

TypeError: int() argument must be a string or a number, not 'IntegerField' pi.hardware_PWM(12, 200, int(form.one_white))

What am I doing wrong?

Syscall
  • 19,327
  • 10
  • 37
  • 52

1 Answers1

1

thx for @SuperShoot i have the answer to my problem!

instead of

    form.one_white

I have to use

    for.one_white.data

where the "form" directs to my form.py file and the "one_white" is an IntegerField variable.

works pretty fine, due to the way how I made the code I had to add a try-except method, because first there is no value, so I got ValueError