Hatkat

IR-REMOTE MANEJO CODE

Dec 29th, 2023
1,068
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. from machine import Pin
  2. from ir_rx.nec import NEC_16
  3. import time
  4.  
  5. def callback(data):
  6.    
  7.     if(data != -1):
  8.         print("El codigo del control es: " + str(data))
  9.        
  10. pinIR = 0 # numero de PIN conectado al OUT del sensor IR
  11.  
  12. pin_ir = Pin(pinIR, Pin.IN)
  13.  
  14. # Cambia NEC_8 por la clase adecuada si es necesario
  15. ir_receiver = NEC_16(pin_ir, callback)  
  16.  
  17. while True:
  18.     pass
  19.        
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment