Skip to content

Instantly share code, notes, and snippets.

@boochow
Created October 21, 2018 08:54
Show Gist options
  • Save boochow/181de3a19442471a2fb7e5467d559727 to your computer and use it in GitHub Desktop.
Save boochow/181de3a19442471a2fb7e5467d559727 to your computer and use it in GitHub Desktop.
from machine import *
def test():
saw = []
sqw = []
tri = []
for i in range(64):
saw.append(i*4)
sqw.append(255 if i < 32 else 0)
tri.append(abs(i - 32)*8)
Clock(Clock.PWM, source=Clock.OSC, divi=2, divf=0, mash=0)
p = PWM(Pin(18), tick_hz=96000000, duty_ticks=0, period=256, ms=PWM.MS_DISABLE, use_fifo=1)
p.fifo_clear()
while True:
for i in range(1000):
for w in saw:
p.fifo_queue(w)
for i in range(1000):
for w in sqw:
p.fifo_queue(w)
for i in range(1000):
for w in tri:
p.fifo_queue(w)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment