Why do you have "int halfPeriod = 3;"? A half period of 38.5 kHz is about 13 microseconds, not 3.
Also, why do 70 cycles when there are 38.5 cycles per millisecond?
Why do you have "int halfPeriod = 3;"? A half period of 38.5 kHz is about 13 microseconds, not 3.
Also, why do 70 cycles when there are 38.5 cycles per millisecond?