Closed WTHfloyd closed 4 years ago
Hi, Sorry I respond to you on my site, and I don't remeber to write here, I repeat.
I think that the example I insert in the library is not so clear so you must change PCF8574 pcf8574(&I2Cone, 0x38); in PCF8574 pcf8574(&I2Cone, 0x38, 27, 14); and remove I2Cone.begin(27,14,100000);
Tell me if It’s ok.
Bye Renzo
Hi Renzo
Thanks - let me try. And since I could not figure it out...
I ended up using the MCP23017 gpio extender.... I like it better. No weird reverse logic for the status of pins.
Cheers.
Phil
Hi Renzo Thanks - let me try. And since I could not figure it out... I ended up using the MCP23017 gpio extender.... I like it better. No weird reverse logic for the status of pins. Cheers. Phil
From: Renzo Mischianti notifications@github.com Sent: Friday, January 24, 2020 12:30 PM To: xreef/PCF8575_library PCF8575_library@noreply.github.com Cc: Philip Chisholm phil@filzer.com; Author author@noreply.github.com Subject: Re: [xreef/PCF8575_library] Esp32 - changing pins (#1)
Hi, Sorry I respond to you on my site, and I don't remeber to write here, I repeat.
I think that the example I insert in the library is not so clear so you must change PCF8574 pcf8574(&I2Cone, 0x38); in PCF8574 pcf8574(&I2Cone, 0x38, 27, 14); and remove I2Cone.begin(27,14,100000);
Tell me if It’s ok.
Bye Renzo
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/xreef/PCF8575_library/issues/1?email_source=notifications&email_token=AEII6DABORZNFITIQYDTJJ3Q7MJRVA5CNFSM4J56VQKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ3KYZQ#issuecomment-578202726, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEII6DAT7JP3CMHG6ACYSDLQ7MJRVANCNFSM4J56VQKA.
I am trying to add a PCF8575 (well actually a PCF8574) to an esp32cam . But should be the same... (note I am a little new at this...)
I am trying to map to different pins for the SDA and SCL - since the esp32cam SDA and SCL pins are not avaialbe. But I believe I should be able to map them to most any pin. But can't make it work.
I wanted to change pins for the SDA and SCL on an esp32. I wanted to use pins 27 and 14 for an esp32 for testing (but really I wanted this for an esp32cam using pins 12 and 2).
I tried using the wire.h library and the PCF8574 lib...but for some reason it keep son forcing pins 21 and 22 as the SDA and SCL...and I did read that I need to sort out the .cpp files to make sure it is not being forced to set SDL and SCL pins... on this tutorial https://randomnerdtutorials.com/esp32-i2c-communication-arduino-ide/ but I have no clue how to do that!!
And I see on a different sensor - the libraries will allow you to change pins...with the twowires...
"In those cases, you need to take a closer look at the .cpp library files and see how to pass your own TwoWire parameters." https://randomnerdtutorials.com/esp32-i2c-communication-arduino-ide/ . But I cannot figure out how to do this...
For testing I was using the code below.
But pins should be mapped to 27 and 14.... How to fix?? Can you update library to allow mapping?? Or am I doing something wrong? Thanks!
include "Wire.h"
include "Arduino.h"
include "PCF8574.h"
TwoWire I2Cone = TwoWire(0);
PCF8574 pcf8574(&I2Cone, 0x38);
(note your tutorial it think it has typo... line 39 >> PCF8574 pcf8574(&I2Ctwo, 0x20); >>> I think it should be PCF8574 pcf8574(&2Ctwo, 0x20); ) Your editor is added letters...
void setup(){
Serial.begin(115200); delay (100);
I2Cone.begin(27,14,100000);
// Set the pinModes pcf8574.pinMode(P0, OUTPUT); pcf8574.pinMode(P1, OUTPUT); pcf8574.begin(); }
void loop(){ pcf8574.digitalWrite(P0, HIGH); pcf8574.digitalWrite(P1, LOW); delay(1000); pcf8574.digitalWrite(P0, LOW); pcf8574.digitalWrite(P1, HIGH); delay(1000); }