# Candle Flicker # Create a flickering LED connected to pin 16 from machine import Pin, PWM from time import sleep_ms import random red = Pin(16, Pin.OUT) red16 = PWM(Pin(16)) red16.freq(1000) def randn(): x = -6 for i in range(0,12): x += random.random() return(x) while(1): x = 32000 + randn()*10000 red16.duty_u16(int(x)) sleep_ms(50)