Comments (9)
Wiring is the forerunner to the Arduino environment. The Wire class which you reference is also available in the Arduino environment. Both of these classes use the built-in microcontroller hardware to communicate over I2C, using dedicated pins. SoftWire was created to allow multiple, independent I2C buses by emulating the correct behaviour in software on arbitrary pins. Unless you know that you need a software implementation SoftWire is probably not what you are looking for. I'm not familiar with the PCA9685 but I think what you probably need is https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library
from softwire.
Dear Steve, Could you provide documentation on Softwire library which demonstrate use for multiple i2c bus for reference? any example for multiple i2c bus on different pins?
from softwire.
@Amajad take a look at the example at https://github.com/stevemarple/SoftWire/blob/master/examples/ListDevices/ListDevices.ino
For the second bus (let's call it sw2) using pins 10 and 11 then you'd add
SoftWire sw2(SDA, SCL);
Then just duplicate all the functions calls on sw to be called on sw2 also.
from softwire.
Thank you sir.
from softwire.
Does your library support multiple I2C busses with shared SCL, to reduce pins ?
(if there are not too many sensors or too long wires or too many pullup resistors for SCL).
Software sw1( 9, 8); // sda, scl
Software sw2( 10, 8);
Software sw3( 11, 8);
Software sw4( 12, 8);
from softwire.
@Koepel I don't think you can share SCL across I2C busses regardless of the implementation (you'd be sending data to all busses). I think it should be possible to share SDA across I2C busses if all devices are fully compliant. The library wasn't written with that mode of operation in mind but I can't think of anything which would prevent it working.
from softwire.
I also could not found something that would prevent it to work.
The SCL should be shared, not SDA. When the SDA goes low, it is the beginning of a start condition. As long as the SDA stays high, the SCL can become high and low, it doesn't matter. The hardware start logic in the slave is never activated when the SDA stays high.
When there are for example ten I2C busses with a single SCL. Then nine of them keep the SDA high, and only one SDA works together with SCL for a start condition, data transfer and stop.
from softwire.
@Koepel It's a while since I wrote the library so I don't remember all the details of I2C but the stop()
function does set SDA high so I think it will probably work. Please try and let me know how you get on.
from softwire.
Sorry, I don't have the time to try it with your library. The shared SCL is a normal thing to do as far as I know.
from softwire.
Related Issues (20)
- configure SoftWire and set up buffer HOT 1
- setSclLow in the example and setSetSclLow in the include file. HOT 1
- I2C EEPROM example not working correctly (Wire functions used) HOT 1
- Better documentation of run-time setting sda and scl pins HOT 1
- Can't compile the SoftWire_MLX90614 example HOT 1
- Softwire and Heltec OLED HOT 1
- Adafruit_MLX90614 and MAX30102 Not working HOT 5
- Bug in DS1307 hour in case of 24h mode
- Bug in DS1307 hour in case of 24h mode HOT 1
- calling setClock(0) made arduino micro unrecognizable by windows HOT 5
- Restart condition is not issued HOT 5
- Information request HOT 1
- llStartWait() case nack needs to include break or return HOT 3
- Minimum SCL frequency HOT 5
- Not available on rp2040 (raspberry pie Pico).
- PCF8583 event counter not woking with SoftWire HOT 10
- Air001 sw.write() output is missing HOT 1
- Wire.onRequest(handler) Support?
- softwire i2c for liquid crystal lcd
- example SoftWire_MLX90614 not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from softwire.