[PD] Sensors GPIO Raspberry Pi Pd
martin.peach at sympatico.ca
Fri May 3 19:17:42 CEST 2013
On 2013-05-03 12:34, Julian Brooks wrote:
> Ok - thanks for that, makes more sense now.
> When I run the C code this happens:
> "./jb_d6t_reader_ic3 0
> ...export file accessed, new pin now accessible
> ...direction set to output
> ./jb_d6t_reader_ic3: initialized:0
> Write failed (5)
> >> Input/output error <<
> ...unexport file accessed, pin now inaccessible"
> I've done my best to go through the code and make changes where appropriate.
> Replaced D6T8L with DRT44L2 and changed packet size.
> Altered all references for 2nd sensor to DRT44L2 and also changed i2c-1
> to 0 for rev1 board.
> Weirdly I can't access the i2c bus anymore?
> cat /dev/i2c*
> cat: /dev/i2c-0: Input/output error
> cat: /dev/i2c-1: Input/output error
Yes I get that too. (unless the sensor returns one byte it's probably
normal) But "i2cdetect -y 1" still shows a sensor at 0x0A.
I run the code as "sudo ./d6t_reader 0", otherwise I don't have
permission to set the GPIO pin.
I don't get any write errors though.
Are you writing to the correct i2c?
There are two places in the code that could throw the write error. Maybe
change the message so you can tell which one it is.
Anyway the setup should work with the old code (only one sensor), the
4051 circuit should have no effect on the communication betwen the Pi
and one of the sensors, the select pin select which sensor receives the
clock. So if the older code isn't working the circuit is wrong,
otherwise the code is buggy.
More information about the Pd-list