Code Monkey home page Code Monkey logo

Comments (11)

bertmelis avatar bertmelis commented on August 22, 2024

I can't think of a reason, the lib really doesn't do anything special.

Although, why are you defining sds011Serial? By default, all the hardware serial objects are already defined as Serial, Serial1 and Serial2.

from sds011.

zen85 avatar zen85 commented on August 22, 2024

I can't think of a reason, the lib really doesn't do anything special.

Although, why are you defining sds011Serial? By default, all the hardware serial objects are already defined as Serial, Serial1 and Serial2.

i did this because in the esp32 example in the main.cpp it is also done like this.
I tried to take the example and rewrite it for arduino IDE. actually i did not really write anything.... just copied the code together since it looked quite straight-forward.

from sds011.

bertmelis avatar bertmelis commented on August 22, 2024

Oh, you're right. I wonder why I did it...

You're using the latest Arduino core, right? Because Platformio is lagging a few version behind and Hardware serial has been completely refactored.

from sds011.

zen85 avatar zen85 commented on August 22, 2024

Oh, you're right. I wonder why I did it...

You're using the latest Arduino core, right? Because Platformio is lagging a few version behind and Hardware serial has been completely refactored.

yes i am using the latest version - i try to stay up do date :)

is this maybe correlated to my problem?

from sds011.

zen85 avatar zen85 commented on August 22, 2024

I changed the sketch as i could not identify any other dealbreakers in the library itself.... unfortunatly no change... :(

#include <SDS011.h>



SDS011 sds011;

void setup() {



  
  Serial.begin(115200);
  sds011.setup(&Serial1, 15, 2);  // Rx on GPIO14; Tx on GPIO12
    
  sds011.onData([](float pm25Value, float pm10Value) {
    Serial.println("Data arrived: PM2.5 = " + String(pm25Value, 1) + " μg/m³; PM10 = " + String(pm10Value, 1) + " μg/m³");
  });

  sds011.onResponse([](uint8_t command, uint8_t set, uint8_t result) {
    Serial.println("Response to command 0x" + String(command, HEX) + " received: 0x" + String(result, HEX));
  });

  sds011.onError([](int8_t error) {
    Serial.println("Error occurred: 0x" + String(error, HEX));
  });

  sds011.setWorkingPeriod(1);
  Serial.println("Data should appear on the default serial port in less than a minute");
}

void loop() {
   
  sds011.loop();
}

`

from sds011.

bertmelis avatar bertmelis commented on August 22, 2024

And you are sure the pins you assign are correct? Because your comment gives the gpio numbers but in the code you use other numbers.

Are you using a premade board or your own design?

from sds011.

zen85 avatar zen85 commented on August 22, 2024

i am using an esp32 from az-delivery. - yes i am aware of the different gpio numbers i am using. the wiring works. with different libraries i can measure without any problem... but i did not find any non-blocking libraries that work - therefor yours is so interesting to me.

from sds011.

bertmelis avatar bertmelis commented on August 22, 2024

I'll start my setup but I can only test with an esp8266. I only got one device and it is soldered.

Now, there should be no difference between 32 and 8266.

from sds011.

zen85 avatar zen85 commented on August 22, 2024

this would be so great... in case i can help by ordering a device for you i will gladly do that and i am keen on testing whatever you find out :)
thank you so much!

from sds011.

zen85 avatar zen85 commented on August 22, 2024

i am terribly sorry...

i just rewired everything again after another library failed too... and apparently one of the pins was loose and kind of fiddly... i fixed that and it started working... sorry if this occupied your time.

from sds011.

bertmelis avatar bertmelis commented on August 22, 2024

No worries. I'm happy it works.

from sds011.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.