Skip to content

Instantly share code, notes, and snippets.

@anoken
Created September 2, 2019 23:06
Show Gist options
  • Save anoken/ab62a81da82684f37d45ef1d8a68312e to your computer and use it in GitHub Desktop.
Save anoken/ab62a81da82684f37d45ef1d8a68312e to your computer and use it in GitHub Desktop.
006_LED.py
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