forked from felias-fogg/SlowSoftWire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bernhard Nebel
committed
Dec 30, 2017
1 parent
947419c
commit f34d777
Showing
4 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// -*- c++ -*- | ||
// Simple sketch to read out one register of an I2C device | ||
|
||
#define I2C_7BITADDR 0x68 // DS1307 | ||
#define MEMLOC 0x0A | ||
#define ADDRLEN 1 | ||
|
||
#include <SlowSoftWire.h> | ||
|
||
SlowSoftWire Wire = SlowSoftWire(A4, A5); | ||
|
||
void setup(void) { | ||
Serial.begin(57600); | ||
Wire.begin(); | ||
} | ||
|
||
void loop(void){ | ||
Wire.beginTransmission(I2C_7BITADDR); | ||
for (byte i=1; i<ADDRLEN; i++) Wire.write(0x00); | ||
Wire.write(MEMLOC); | ||
Wire.endTransmission(false); | ||
Wire.requestFrom(I2C_7BITADDR,1); | ||
byte val = Wire.read(); | ||
Serial.println(val); | ||
delay(1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
SlowSoftWire KEYWORD1 | ||
begin KEYWORD2 | ||
end KEYWORD2 | ||
setClock KEYWORD2 | ||
beginTransmission KEYWORD2 | ||
endTransmission KEYWORD2 | ||
write KEYWORD2 | ||
requestFrom KEYWORD2 | ||
available KEYWORD2 | ||
read KEYWORD2 | ||
peek KEYWORD2 | ||
flush KEYWORD2 | ||
|