How to create a 38 Khz pulse with arduino using timer or PWM?
i want create square wave of 38 khz fed ir led.
one way make pin high , low 13 microseconds each. can not use approach since requires use of loop function.
my program rather big , not able handle complexities of doing other tasks creating 38 khz wave both in loop() (if can done @ all)
my question is, there way, using timer or else achieve purpose? can start timer in setup() , pin in question have 38khz square long program runs.
i using arduinomega
thanks
one way make pin high , low 13 microseconds each. can not use approach since requires use of loop function.
my program rather big , not able handle complexities of doing other tasks creating 38 khz wave both in loop() (if can done @ all)
my question is, there way, using timer or else achieve purpose? can start timer in setup() , pin in question have 38khz square long program runs.
i using arduinomega
thanks
i don't have experience mega, looks has quite few timers knocking about. seems should possible take 1 of unused timers , have toggle 1 of ocxn pins.
take @ timer section in data sheet, , have here http://maxembedded.wordpress.com/2011/07/14/avr-timers-ctc-mode/ more information on having timer toggle pin in background purely through hardware.
just make sure don't tread on else using particular timer, or there might issues.
take @ timer section in data sheet, , have here http://maxembedded.wordpress.com/2011/07/14/avr-timers-ctc-mode/ more information on having timer toggle pin in background purely through hardware.
just make sure don't tread on else using particular timer, or there might issues.
Arduino Forum > Using Arduino > Programming Questions > How to create a 38 Khz pulse with arduino using timer or PWM?
arduino
Comments
Post a Comment