hybridgroup / gobot

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

[HC-SR04] write /dev/i2c-1: connection timed out #1087

Open TuringZhu opened 2 months ago

TuringZhu commented 2 months ago

Hello, I a beginner gobot & raspberry pi.

Now I use examples/raspi_grove_pi_ultrasonic.go to check with Raspberry Pi Model B and ultrasonic model with HC-SR04.

I have some problems can not be solved.

HC-SR04 has 4 Pin with VCC,GND,Trig_RX-SCL_I/O, ECHO_DX_SDA but the code just defined ultrasonicPin = "4", so how can I connect
my raspberry pi with HC-SR04

and no matter what pin i connect the code always output write /dev/i2c-1: connection timed out. I want to know why.

in addition, I hope to have a website or other chat groups can get other developer's help quickly. I would be extremely grateful.

gen2thomas commented 1 month ago

Hello @TuringZhu ,

do you have really an I2C ultrasonic Model with the name HC-SR04? Normally this is an analog one. Please try to use this example instead: https://github.com/hybridgroup/gobot/blob/release/examples/raspi_hcsr04.go

Good luck, Thomas

gen2thomas commented 1 week ago

Hi @TuringZhu do you have any progress or further questions on that?

Maybe we can close this issue?

Thanks Thomas