Hello
I have bought a MCP23008 I/O Expander with use the I2C-Bus.
So i started to make programs for it.
To use the I/O Ports for the Expander as a Output was not difficult, but now I don't know what to do.
I have searched the net and i used the Examples from Ardunino, but every time was the same.
When i read from the Expander i get something like that, from the Serial Monitor:
0
0
0
0
0
0
0
0
17
0
255
0
0
0
0
0
0
0
0
17
0
255
There is a shema, it comes all the time.....the ninth read is this what i have wired (there it is "17") , but why there a so much "0" and why is there "255"????
It is a 8Bit Expander so i thought i will get a DEZ or HEX Number like 0x20 or 20 or not?????
My Programmcode:
#include <Wire.h>
int i2c_adresse = 0b0100000;
int read_write = 0xFF;
byte temp = 0b00000000;
//Einlesen
void setup()
{
Wire.begin();
/*
Wire.beginTransmission(i2c_adresse);
Wire.write(0x00);
Wire.write(read_write);
Wire.endTransmission();
*/
Serial.begin(9600);
}
void loop()
{
Wire.requestFrom(i2c_adresse, 1);
while(1 <= Wire.available())
{
temp = 0;
Serial.println(temp);
temp = Wire.read();
Serial.println(temp);
}
delay(500);
}
Thx for help and sorry for my english