我正在尝试建立空调控制系统,这将允许我使用网络应用程序控制交流。 到目前为止,我已经和Arduino做了同样的事情,它适用于这种特殊的空调。我可以发送和接收信号,所以我不认为硬件有任何问题。 到目前为止,irsend没有给我任何错误,但信号没有发送,虽然我尝试了一些使用python的LED测试代码并且它有效。 这是/ etc / modules:
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
lirc_dev
lirc_rpi gpio_out_pin=22
这是/etc/lirc/hardware.conf:
########################################################
# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
#
LIRCD_ARGS=""
#
# Don't start lircmd even if there seems to be a good config file
# START_LIRCMD=false
#
# Don't start irexec, even if a good config file seems to exist.
# START_IREXEC=false
#
# Try to load appropriate kernel modules
LOAD_MODULES="true"
# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="default"
# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"
# Default configuration files for your hardware if any
#changed for true
LIRCD_CONF="/etc/lirc/lircd.conf"
LIRCMD_CONF=""
########################################################
和/boot/config.txt:
# For more options and information see
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details
# Uncomment this to enable the lirc-rpi module
dtoverlay=lirc-rpi, gpio_out_pin=22
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
任何人都可以知道为什么没有发送信号?连接似乎是正确的,22 gpio,但是对于使用15来检查它是否正常工作的python代码:
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(15, GPIO.OUT)
for i in range(0,10):
GPIO.output(15,True)
time.sleep(0.5)
GPIO.output(15,False)
time.sleep(0.5)
print "Done"
GPIO.cleanup()
P.S。我试图改变22到15,没有成功。 :(
答案 0 :(得分:0)
发现错误,Raspberry Pi没有读取我的/ etc / modules,所以当我在/etc/modules-load.d/lirc_rpi.conf中保存相同的数据时,它工作正常:
lirc_dev
lirc_rpi gpio_in_pin=22 gpio_out_pin=23
i2c-dev