Files
mraa/examples/python/pwm.py
Thomas Ingleby 170bdd104f spdx: add spdx tags to most files
Large change that removes the duplicated MIT notice withe a spdx tag

Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2019-05-23 10:09:12 -07:00

33 lines
496 B
Python

#!/usr/bin/env python
# Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
# Copyright (c) 2014 Intel Corporation.
#
# SPDX-License-Identifier: MIT
#
# Example Usage: Generates PWM at a step rate of 0.01 continuously.
import mraa
import time
# initialise PWM
x = mraa.Pwm(3)
# set PWM period
x.period_us(700)
# enable PWM
x.enable(True)
value= 0.0
while True:
# write PWM value
x.write(value)
time.sleep(0.05)
value = value + 0.01
if value >= 1:
value = 0.0