Strange timings using pigpio - Raspberry Pi Forums


hello community!

first post in great forum! i'm complete, happy newbie both regarding pi , coding. mission control heat pump on web. managed decode signal remote using analysir, , figured nice little project learn python , create ir signal based on user input. learned not-so-straight-forward challange of generating microsecond level-timed signals on pi's gpio. found pigpio library trick. think understand how should done , here piece of test code sends 1 byte (byte1)

code: select all

import sys import time import pigpio  byte1 = [1,1,1,1,0,0,0,0]  def transmit_byte(pi, gpio, byte):     pi.wave_clear() # clear waveforms     bit in range(0,8):                wf=[]        bit in range(0,8):       if byte[bit] == 1:          wf.append(pigpio.pulse(1<<gpio, 0, 450))    #bit mark          wf.append(pigpio.pulse(0, 1<<gpio, 1300))  #one space       else:          wf.append(pigpio.pulse(1<<gpio, 0, 450))   #bit mark          wf.append(pigpio.pulse(0, 1<<gpio, 420))   #zero space       bit=bit+1     pi.wave_add_generic(wf)     wid = pi.wave_create()     if wid >= 0:       pi.wave_send_once(wid)  pi = pigpio.pi()  gpio = 18  pi.set_mode(gpio, pigpio.output)  transmit_byte(pi, gpio, byte1)  while pi.wave_tx_busy():    time.sleep(0.1)  pi.stop() 
problem timings set in code doesn't match leaves ir diode. spaces 200 longer. , more confusing, regardless of value set bit mark, measured output around 200 us? since drive me crazy kind of desperate help.

should perhaps generate 38khz carrier not using pi separate circuit on breadboard using 555 timer lc.

appriciate on this, in advance!

best

i've ran code (with removal of erroneous first "for bit in range(0,8):" line) , think intend.
fc4.png
fc4.png (44.75 kib) viewed 1008 times
suspect external carrier generation. add carrier wave.


raspberrypi



Comments