Created
September 2, 2019 23:06
-
-
Save anoken/ab62a81da82684f37d45ef1d8a68312e to your computer and use it in GitHub Desktop.
006_LED.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time,cmath,math | |
from machine import Timer,PWM | |
from fpioa_manager import * | |
tim = Timer(Timer.TIMER0, Timer.CHANNEL0, mode=Timer.MODE_PWM) | |
ch = PWM(tim, freq=500000, duty=0, pin=board_info.LED_R) | |
cnt=0 | |
while(True): | |
duty=0 | |
b=cmath.sin(cnt).real | |
a=math.fabs(b)*100 | |
print(a) | |
ch.duty(a) | |
cnt=cnt+0.003 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment