I would like to set up communication between mBot2 and micro:bit based robot using IR rx/tx module. I have some 3rd party IR modules that works fine with micro:bit, arduino, etc. Is there any extension or maybe somebody has any experience connecting those IR modules to S1, S2 ports on mBot2 or CyberPi to make them work? Any idea?
mBot2/CyberPi and 3rd party IR RX/TX modules
Ok, so to be clear, first of all I would like to attach IR TX (https://wiki.keyestudio.com/Ks0027_keyestudio_Digital_IR_Transmitter_Module) to CyberPi S1 and send signals to other branded robots that have IR RX.
I’m trying to reproduce signal patter from here - https://techdocs.altium.com/display/FPGA/NEC+Infrared+Transmission+Protocol
Basically I use only 2 commands - cyberpi.pocket.write_digital and time.sleep.
But it looks like CyberPi is not able to provide short signals - the code doesn’t work.
Any ideas please?
My Python code is below:
import event, time, cyberpi
@event.is_press(‘b’)
def is_btn_press():
init_burst()
for count in range(8):
burst_0()for count2 in range(8): burst_1() burst_1() burst_0() burst_1() burst_1() burst_0() burst_1() burst_0() burst_1() burst_0() burst_1() burst_0() burst_0() burst_1() burst_0() burst_1() burst_0() end_burst()
def end_burst ():
for count3 in range(21):
pulse()cyberpi.pocket.write_digital(1, "S1") time.sleep(0.000013078201036) cyberpi.pocket.write_digital(0, "S1")
def init_burst ():
for count4 in range(344):
pulse()time.sleep(0.0045)
def pulse ():
cyberpi.pocket.write_digital(1, “S1”)
time.sleep(0.000008720980936)
cyberpi.pocket.write_digital(0, “S1”)
time.sleep(0.000017441961872)def burst_1 ():
for count5 in range(21):
pulse()cyberpi.pocket.write_digital(1, "S1") time.sleep(0.000013078201036) cyberpi.pocket.write_digital(0, "S1") time.sleep(0.0016875)
def burst_0 ():
for count6 in range(21):
pulse()cyberpi.pocket.write_digital(1, "S1") time.sleep(0.000013078201036) cyberpi.pocket.write_digital(0, "S1") time.sleep(0.0005625)
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.