# Pulse Sensor Code import LCD from machine import ADC from time import sleep_ms a2d1 = machine.ADC(1) a2d2 = machine.ADC(2) x0 = 0 def Read_Sawtooth(): global x0 x0 = (x0+1)%64 y = 0x8000 + (x0-32) return(y) def Read_Joystick(): a2d = a2d1.read_u16() y = 0x8000 + (a2d - 0x8000) // 1024 return(y) def Read_Heartbeat(): a2d = a2d2.read_u16() y = a2d return(y) White = LCD.RGB(250,250,250) Black = LCD.RGB(0,0,0) LCD.Init() LCD.Clear(Black) LCD.Title('Pulse Sensor', White, Black) npt = 480 x = 0 Y = [0]*480 while(1): sleep_ms(5) x = (x+1)%480 LCD.Pixel(x, 185-Y[x], Black) #Y[x] = Read_Heartbeat() #Y[x] = Read_Joystick() Y[x] = Read_Sawtooth() LCD.Pixel(x, 185-Y[x], White)