MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / write

Method write

Software/Python/easysensors.py:471–485  ·  view source on GitHub ↗

Generates a PWM signal on the selected port. Good for simulating an DAC convertor - for instance an LED is a good candidate. :param int power: Number from **0** to **100** that represents the duty cycle as a percentage of the frequency's period. .. tip::

(self, power)

Source from the content-addressed store, hash-verified

469 return reading_percent
470
471 def write(self, power):
472 """
473 Generates a PWM signal on the selected port.
474 Good for simulating an DAC convertor - for instance an LED is a good candidate.
475
476 :param int power: Number from **0** to **100** that represents the duty cycle as a percentage of the frequency's period.
477
478 .. tip::
479
480 If the ``power`` parameter is out of the given range, the most close and valid value will be selected.
481
482
483 """
484 self.value = power
485 self.gpg.set_grove_pwm_duty(self.get_pin(), power)
486
487
488 def write_freq(self, freq):

Callers 4

soundMethod · 0.45
light_onMethod · 0.45
light_offMethod · 0.45
runMotorMethod · 0.45

Calls 2

get_pinMethod · 0.80
set_grove_pwm_dutyMethod · 0.45

Tested by

no test coverage detected