hybridgroup / gobot

Golang framework for robotics, drones, and the Internet of Things (IoT)
https://gobot.io
Other
8.81k stars 1.04k forks source link

Using PIR Motion Sensor HC-SR501 with Raspberry Pi Model 3 #723

Closed r3rivera closed 1 year ago

r3rivera commented 4 years ago

I've been trying to use the example provided https://gobot.io/documentation/drivers/pir-motion-sensor/ but used a different pin. The code can be found in https://play.golang.org/p/f1UQDG1htvP

However, using the /dev/ttyACM0 gives me an error saying that the directory is not found. it looks like most of the search result is pointing to Arduino. I checked /dev/ folder and the one that I can see that close enough is /dev/ttyS0 and /dev/ttyAMA0.

I tried both but it gives me the error of :

2020/01/14 23:00:00 Initializing connections... 2020/01/14 23:00:00 Initializing connection Firmata-3C07783D ... 2020/01/14 23:00:00 Initializing devices... 2020/01/14 23:00:00 Initializing device PIRMotion-4B88C798 ... 2020/01/14 23:00:00 Initializing device LED-3F3261EF ... 2020/01/14 23:00:00 Robot motionBot initialized. 2020/01/14 23:00:00 Starting Robot motionBot ... 2020/01/14 23:00:00 Starting connections... 2020/01/14 23:00:00 Starting connection Firmata-3C07783D on port /dev/ttyAMA0... 2020/01/14 23:00:15 1 error occurred:

r3rivera commented 4 years ago

Nevermind. I just used the default raspi driver. https://play.golang.org/p/TTQDDMgNN0W