Skip to content

Commit

Permalink
new example
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard Nebel committed Dec 30, 2017
1 parent 947419c commit f34d777
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SlowSoftWire
=========
# SlowSoftWire

A wrapper for SlowSoftI2CMaster emulating the functionality of the Wire library (for master clients). In order to use it, you also have to download [SlowSoftI2CMaster](https://github.com/felias-fogg/SlowSoftI2CMaster).

Expand Down
1 change: 0 additions & 1 deletion examples/BMA020SlowWire/BMA020SlowWire.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// Readout BMA020 chip

// use low processor speed (you have to change the baud rate to 2400!)

#include <SlowSoftI2CMaster.h>
#include <avr/io.h>
Expand Down
26 changes: 26 additions & 0 deletions examples/simpleSlowWire/simpleSlowWire.ino
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);
}
13 changes: 13 additions & 0 deletions keywords.txt
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

0 comments on commit f34d777

Please sign in to comment.