VS1838B Infrared IR Receiver

3 Pin receiver for infrared remote control and IR data transmission. Demodulated ~40kHz signal carrier to decode modulated data. >15 meter reception distance.


25 ₪

الناشر: متجر القطع الالكترونية

القسم: مستشعرات - سينسور

تاريخ النشر: 2023-11-18




raspberry pi

by chatGPT -- code not tested

code
نسخ
اقتباس
عرض
تنزيل
	
								
import RPi.GPIO as GPIO import time PIN_TX = 17 # Assuming GPIO pin 17 for TX on Raspberry Pi PIN_RX = 18 # Assuming GPIO pin 18 for RX on Raspberry Pi count = 0 def falling_callback(channel): global count count += 1 def on(length): for _ in range(length): GPIO.output(PIN_TX, GPIO.HIGH) time.sleep(0.0006) GPIO.output(PIN_TX, GPIO.LOW) time.sleep(0.0009) def setup(): GPIO.setmode(GPIO.BCM) GPIO.setup(PIN_TX, GPIO.OUT) GPIO.setup(PIN_RX, GPIO.IN) GPIO.add_event_detect(PIN_RX, GPIO.FALLING, callback=falling_callback) count = 0 def loop(): on(10) print(count) time.sleep(1) if __name__ == "__main__": setup() try: while True: loop() except KeyboardInterrupt: GPIO.cleanup()


سلة المشتريات افراغ السلة