local pwmfrequency local pwmdutycycle local rollvalue local divisor = 4 local mbwrite = MB.W outPin = 0 LJ.IntervalConfig(1, 1000) while true do if LJ.CheckInterval(1) then pwmdutycycle = 55 pwmfrequency = 0.5 rollvalue=(80000000/pwmfrequency)/divisor mbwrite(44000,1,0) --disable dio0 pin mbwrite(44900,0,0) --disable clock0 mbwrite(44100,1,0) --pwm index mode mbwrite(44901,0,divisor) --divisor mbwrite(44904,1,rollvalue) --pwmrollvalue mbwrite(44300,1,(rollvalue*pwmdutycycle)/100) --config A mbwrite(44000,1,1) --enable dio0 pin mbwrite(44900,0,1) --enable clock0 print("On FIO0 a ", pwmfrequency, "Hz signal at a ", pwmdutycycle, "% duty cycle has been generated") end end