I started a new project using the Raspberry pi Pico and I wanted to create a simple remote IR controller for my air conditioner.
Using the USB analysIR I have extracted the Start "code" of my air conditioner and I wrote this code:
Code: Select all
from machine import Pin
import utime
import time
# Extracted using AnalysIR RAW format
data = '3358 -1678 420 -1260 420 -1260 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -1260 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -1260 420 -1260 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -1260 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -1260 420 -420 420 -1260 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -1260 404 -11364 3358 -1678 420 -1260 420 -1260 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -1260 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -1260 420 -1260 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -1260 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -1260 420 -420 420 -1260 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -420 420 -1260 420 -420 420 -420 420 -1260 420 -1260 420 -420 420 -1260 420'
iro = Pin(17, Pin.OUT, Pin.PULL_DOWN)
code = [int(element) for element in data.split(' ')]
def send_code(pin, code):
for element in code:
[pin.on, pin.off][element < 0]()
utime.sleep_us(abs(element))
while True:
send_code(iro, code)
print('ok')
iro.off()
time.sleep(3)
I have also tried to connect the SendIR module but without success. It flashes the led following a pattern but the air conditioner do not turns on. Using the USB Stick and the program LearnIR it works fine.
If anyone could help me with this I would be very grateful ... Thanks in advance!