ich hab so einen Ding um ein 128x64Pixel Display am I2C-Bus anzuschliessen.
Ich hab nach einigem Suchen auch einen Sketch gefunden, aber ich kriege immer die foelgende Fehlermeldung:
LCDBV4512I2C.cpp:31:8: error: 'class TwoWire' has no member named 'send'
Die Anleitung dazu hab ich auf einer spanischen Seite gefunden: http://arduino.trucados.com/?cat=14
Allerdings versteh ich mit dem Google-Übersetzte fast weniger als ohne
Wie könnte ich die Fehlermeldung weg kriegen?
Oder kennt jemand eine Library mit der ich mal etwas rumexperimentieren kann?
seit der 1.0 heißt es read und write statt recieve und send.
The Wire library has also been modified to use the standard read() and write() functions instead of send() and receive(). You can also use print() and println() for outgoing data.
Leider kriege ich diese Library nicht zum laufen...
Ich versuche jetzt einfach mal nur die Hintergrundbeleuchtung ein-/auszuschalten. Aber ich kriege nicht mal das hin
#include "Wire.h"
char i2adr = 0x42;
// **************************************************************
// command 6
// backlight on / off send 1 to turn on, 0 for off
// **************************************************************
void BV4512backlight(char onoff)
{
Wire.beginTransmission(i2adr);
Wire.write(6); //Kommando 6 ausführen
Wire.write(onoff);
Wire.endTransmission();
}
Ev. ist das Teil nicht auf der Default-Adresse 0x42 zuhause. Aber wie kann ich das wohl auslesen wie die Adresse ist. Zum umstellen der Adresse muss ich die bestehende nähmlich wissen...
Aber wie kann ich das wohl auslesen wie die Adresse ist ?
Über den I2CScanner
/**
* I2CScanner.pde -- I2C bus scanner for Arduino
*
* 2009, Tod E. Kurt, http://todbot.com/blog/
*
*/
#include "Wire.h"
extern "C" {
#include "utility/twi.h" // from Wire library, so we can do bus scanning
}
// Scan the I2C bus between addresses from_addr and to_addr.
// On each address, call the callback function with the address and result.
// If result==0, address was found, otherwise, address wasn't found
// (can use result to potentially get other status on the I2C bus, see twi.c)
// Assumes Wire.begin() has already been called
void scanI2CBus(byte from_addr, byte to_addr,
void(*callback)(byte address, byte result) )
{
byte rc;
byte data = 0; // not used, just an address to feed to twi_writeTo()
for( byte addr = from_addr; addr <= to_addr; addr++ ) {
rc = twi_writeTo(addr, &data, 0, 1);
callback( addr, rc );
}
}
// Called when address is found in scanI2CBus()
// Feel free to change this as needed
// (like adding I2C comm code to figure out what kind of I2C device is there)
void scanFunc( byte addr, byte result ) {
Serial.print("addr: DEC:");
Serial.print(addr,DEC);
Serial.print(", HEX:");
Serial.print(addr,HEX);
Serial.print( (result==0) ? " found!":" ");
Serial.print( (addr%4) ? "\t":"\n");
}
byte start_address = 1;
byte end_address = 130;
// standard Arduino setup()
void setup()
{
Wire.begin();
Serial.begin(9600);
Serial.println("\nI2CScanner ready!");
Serial.print("starting scanning of I2C bus from ");
Serial.print(start_address,DEC);
Serial.print(" to ");
Serial.print(end_address,DEC);
Serial.println("...");
// start the scan, will call "scanFunc()" on result from each address
scanI2CBus( start_address, end_address, scanFunc );
Serial.println("\ndone");
}
// standard Arduino loop()
void loop()
{
// Nothing to do here, so we'll just blink the built-in LED
digitalWrite(13,HIGH);
delay(300);
digitalWrite(13,LOW);
delay(300);
}