Hallo,
ich habe meinen Nunchuck wie hier angeschlossen:
https://www.roboternetz.de/community/threads/37522-Nunchuk-Bascom-Atmega8-Brauche-hilfe-)/page7?p=428731#post428731
rot - 3,3V
weis - GND
grün - SDA mit 10k pullup an 3,3V
gelb - SCL mit 10k pullup an 3,3V
Ich benutze die I2C Bibliothek von Peter Fleury Bus läuft auf 100khz.
mein quellcode:
Er giebt mir nur hallo aus, test1, test2 oder test3 nicht...Code:#define SLAVE_ADRESSE 0x52 int main(void) { uart_init(); sei(); uart_puts("Hallo!\r\n"); i2c_init(); // initialize I2C library i2c_start_wait(SLAVE_ADRESSE+I2C_WRITE); // set device address and write mode uart_puts("Test1\r\n"); i2c_write(0x40); i2c_write(0x00); i2c_stop(); // set stop conditon = release bus i2c_start_wait(SLAVE_ADRESSE+I2C_WRITE); // set device address and write mode uart_puts("Test2!\r\n"); i2c_write(0x00); i2c_rep_start(SLAVE_ADRESSE+I2C_READ); // set device address and read mode uart_puts("Test3\r\n"); uart_putc(i2c_readNak()); i2c_stop(); }
hat einer eine Idee woran das liegen kann?
gruß
Deko
Lesezeichen