Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeeduino Xiao #72

Open
diegomariani opened this issue Jul 23, 2021 · 9 comments
Open

Seeeduino Xiao #72

diegomariani opened this issue Jul 23, 2021 · 9 comments

Comments

@diegomariani
Copy link

How can use your library in Seeeduino Xiao (SAMD proccessor)?

@mandulaj
Copy link
Owner

Hey, Sorry I don't have a Seeeduino so can't test it for you. However besides potential problems with SoftwareSerial, I see no reason why it should not work.

@diegomariani
Copy link
Author

diegomariani commented Jul 25, 2021 via email

@sergiocntr
Copy link

Hi.
Try the basic example :

`SoftwareSerial pzemSWSerial(PZEM_RX_PIN, PZEM_TX_PIN);
PZEM004Tv30 pzem(pzemSWSerial);

void setup() {
/* Debugging serial */
Serial.begin(115200);
}`

@diegomariani
Copy link
Author

diegomariani commented Jul 25, 2021 via email

@sergiocntr
Copy link

a) this line inside setup() is not needed and broke your sketch:
pzem = PZEM004Tv30(pzemSWSerial);

b) your declaration miss the argument:
PZEM004Tv30 pzem;

This is the good one:
PZEM004Tv30 pzem(pzemSWSerial);

Fix this two issues in your sketch.

@diegomariani
Copy link
Author

diegomariani commented Jul 25, 2021 via email

@mandulaj
Copy link
Owner

I think what might be the problem is the way we conditionally enable SoftwareSerial in the library only on some platforms (AVR and ESP8266).

See here:

#if (not defined(PZEM004_NO_SWSERIAL) && (defined(__AVR__) || defined(ESP8266)) && not defined(ESP32))
/* Software serial is only available for AVRs and ESP8266 */
#define PZEM004_SOFTSERIAL
#endif

So perhaps try force enabling the Software serial by defining PZEM004_SOFTSERIAL manually.

#define PZEM004_SOFTSERIAL

#include <PZEM004Tv30.h>
#include <SoftwareSerial.h>


SoftwareSerial pzemSWSerial(6, 7);
PZEM004Tv30 pzem(pzemSWSerial);

void setup() {


    SerialUSB.begin(115200);

    while (!SerialUSB) { 
         delay(100); 
    }

    SerialUSB.println("start");

}

void loop() {
}

@diegomariani
Copy link
Author

diegomariani commented Jul 25, 2021 via email

@JFRosado
Copy link

I've tried every options suggested here and no luck :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants