mirror of
https://github.com/KevinMidboe/Arduino.git
synced 2025-10-29 17:40:11 +00:00
Init commit with many years of arduino sketches and projects. I dont know if the esp8266 includes much, but there are also libraries. I hope they dont have crazy automatic versioning through the Arduino IDE.
This commit is contained in:
25
Projects/ST_Two_Small_Clock/ST2_TWI/ST2_TWI.ino
Normal file
25
Projects/ST_Two_Small_Clock/ST2_TWI/ST2_TWI.ino
Normal file
@@ -0,0 +1,25 @@
|
||||
//*******************************************************************************************************************
|
||||
// I2C TX RX
|
||||
//*******************************************************************************************************************
|
||||
void I2C_TX(byte device, byte regadd, byte tx_data) // Transmit I2C Data
|
||||
{
|
||||
Wire.beginTransmission(device);
|
||||
Wire.write(regadd);
|
||||
Wire.write(tx_data);
|
||||
Wire.endTransmission();
|
||||
}
|
||||
|
||||
void I2C_RX(byte devicerx, byte regaddrx) // Receive I2C Data
|
||||
{
|
||||
Wire.beginTransmission(devicerx);
|
||||
Wire.write(regaddrx);
|
||||
Wire.endTransmission();
|
||||
Wire.requestFrom(int(devicerx), 1);
|
||||
|
||||
byte c = 0;
|
||||
if(Wire.available())
|
||||
{
|
||||
i2cData = Wire.read();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user