HerrPitillo schrieb:
> Hallo,
> Du hast vergessen das fd zu lesen, ich weiß zwar jetzt nicht genau wofür
> dieses genau gut ist aber du musst dieses auslesen, ungefähr so:#include
<stdio.h>
> #include <stdlib.h>
> #include <wiringPi.h>
> #include <wiringPiI2C.h>
>
> int main ()
> {
> //wiringPiSetupPhys();
> int fd = 0;
> fd = wiringPiI2CSetup(0x53);
> printf("SETUP: %i \n", fd);
> printf("READ: %i \n", wiringPiI2CReadReg8(fd, 0x53, 0x00)); //erwartetes
Ergebnis: 0xe5 bzw. 229
> printf("WRITE: %i \n", wiringPiI2CWriteReg8(fd, 0x53, 0x2D, 0x10));
> exit(EXIT_SUCCESS);
> }
>
> Probier es mal so. Eigentlich sollte es so funktionieren
>
> Gruß HerrPitillo;)
Danke, das hat mich in die Richtige Richtung geführt!
So funktioniert es nun:
1 | #include <stdio.h>
|
2 | #include <stdlib.h>
|
3 | #include <wiringPi.h>
|
4 | #include <wiringPiI2C.h>
|
5 |
|
6 | int main ()
|
7 | {
|
8 | //wiringPiSetupPhys();
|
9 | int fd = 0;
|
10 | fd = wiringPiI2CSetup(0x53);
|
11 | printf("SETUP: %i \n", fd);
|
12 | printf("READ: %i \n", wiringPiI2CReadReg8(fd, 0x00)); //erwartetes Ergebnis: 0xe5 bzw. 229
|
13 | printf("WRITE: %i \n", wiringPiI2CWriteReg8(fd, 0x2D, 0x10));
|
14 | exit(EXIT_SUCCESS);
|
15 | }
|
>Hast du bedacht dass sich am pi zwischen Rev1 und Rev2 die
>Interfacebezeichnung geändert hat (i2c0 vs. i2c1)?
>
>Kenne wiringpi nicht, kann sein dass das da schon berücksichtigt wird.
Das wird bereits berücksichtigt.