Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Device = 18F1320
Clock = 8 // tells the compiler the FOSC speed
Config OSC = INTIO2, WDT = OFF, LVP = OFF
Include "Utils.bas"
Include "PW.bas" // import PWM module..
Dim Duty As Byte
OSCCON = %01111111 // select 8MHz internal oscillator
SetAllDigital
// main program...
PWM.SetFreq(5000) //this set it for a 5000khz
While true
Duty = 80 // this starts it at 2000khz
Repeat
PWM.SetDutyPercent(Duty)
Inc(Duty)
Until Duty > 100 // takes it up to 5000
Repeat
PWM.SetDutyPercent(Duty)
Dec(Duty)
Until Duty = 60 // lower it back down
Wend
Device = 18F1320
Clock = 8 // tells the compiler the FOSC speed
Config OSC = INTIO2, WDT = OFF, LVP = OFF
Include "Utils.bas"
Dim out As PORTB.3
OSCCON = %01111111
SetAllDigital
Low (PORTB.3)
While true
High (out)
DelayUS (1400) // justs change this to change sound
Low (out)
DelayUS (700) // and this to
Wend