from machine import Pin, DAC
from time import sleep
dac = DAC(Pin(25))
push = Pin(14,Pin.IN,Pin.PULL_UP)
lista = [128,143,159,174,189,202,215,226,235,243,249,253,255,255,253,249,243,235,226,215,202,189,174,159,143,128,112,96,81,66,53,40,29,20,12,6,2,0,0,2,6,12,20,29,40,53,66,81,96,112]
n=i=0
while(1):
if push.value()==0:
sleep(0.03)
n=n+1
if n > 2:
n=0
while push.value()==0:
sleep(0.02)
elif n==0:
for i in lista:
dac.write(i)
sleep(0.004)
elif n==1:
for i in lista:
dac.write(i)
sleep(0.0025)
else:
for i in lista:
dac.write(i)
sleep(0.00132)