Skip to main content
improved formatting and clarity
Source Link
per1234
  • 4.3k
  • 2
  • 24
  • 44

I'm fairly new to this and I'm having trouble with a code for a dust sensor. Getting a couple of errors. I downloaded this code from githubGitHub. Anyone have any idea how to fix any of these errors? Any help is appreciated. Sorry if this formatted wrong, this is also my first post. Thanks for your time

// SDS011 dust sensor example
// -----------------------------
//
// By R. Zschiegner ([email protected]).
// April 2016

#include "SDS011.h"
#include<SoftwareSerial.h>
SoftwareSerial myserial(0, 1);
SDS011(byte pin_rx, byte pin_tx)  
float p10,p25;
int error;


SDS011 my_sds;

void setup() {
  my_sds.begin(0, 1);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
}

void loop() {
  error = my_sds.read(&p25,&p10);
  if (! error) {
    Serial.println("P2.5: "+String(p25));
    Serial.println("P10:  "+String(p10));
  }
delay(100);
}

here are the errors I'm getting

code:10: error: expected ')' before 'pin_rx'

SDS011(byte pin_rx, byte pin_tx)

code:10: error: expected ')' before 'pin_rx'

 SDS011(byte pin_rx, byte pin_tx)  

             ^

C:\Users\Nick\Desktop\code\code.ino: In function 'void loop()':

code:26: error: 'p25' was not declared in this scope

error = my_sds.read(&p25,&p10);


C:\Users\Nick\Desktop\code\code.ino: In function 'void loop()':

code:26: error: 'p25' was not declared in this scope

   error = my_sds.read(&p25,&p10);

                        ^

code:26: error: 'p10' was not declared in this scope

error = my_sds.read(&p25,&p10);


code:26: error: 'p10' was not declared in this scope

   error = my_sds.read(&p25,&p10);

                             ^ 

exit status 1
expected ')' before 'pin_rx'

exit status 1 expected ')' before 'pin_rx'

I'm fairly new to this and I'm having trouble with a code for a dust sensor. Getting a couple of errors. I downloaded this code from github. Anyone have any idea to fix any of these errors? Any help is appreciated. Sorry if this formatted wrong, this is also my first post. Thanks for your time

// SDS011 dust sensor example
// -----------------------------
//
// By R. Zschiegner ([email protected]).
// April 2016

#include "SDS011.h"
#include<SoftwareSerial.h>
SoftwareSerial myserial(0, 1);
SDS011(byte pin_rx, byte pin_tx)  
float p10,p25;
int error;


SDS011 my_sds;

void setup() {
  my_sds.begin(0, 1);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
}

void loop() {
  error = my_sds.read(&p25,&p10);
  if (! error) {
    Serial.println("P2.5: "+String(p25));
    Serial.println("P10:  "+String(p10));
  }
delay(100);
}

here are the errors I'm getting

code:10: error: expected ')' before 'pin_rx'

SDS011(byte pin_rx, byte pin_tx)

         ^

C:\Users\Nick\Desktop\code\code.ino: In function 'void loop()':

code:26: error: 'p25' was not declared in this scope

error = my_sds.read(&p25,&p10);

                    ^

code:26: error: 'p10' was not declared in this scope

error = my_sds.read(&p25,&p10);

                         ^

exit status 1 expected ')' before 'pin_rx'

I'm fairly new to this and I'm having trouble with a code for a dust sensor. Getting a couple of errors. I downloaded this code from GitHub. Anyone have any idea how to fix any of these errors? Any help is appreciated. Sorry if this formatted wrong, this is also my first post. Thanks for your time

// SDS011 dust sensor example
// -----------------------------
//
// By R. Zschiegner ([email protected]).
// April 2016

#include "SDS011.h"
#include<SoftwareSerial.h>
SoftwareSerial myserial(0, 1);
SDS011(byte pin_rx, byte pin_tx)  
float p10,p25;
int error;


SDS011 my_sds;

void setup() {
  my_sds.begin(0, 1);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
}

void loop() {
  error = my_sds.read(&p25,&p10);
  if (! error) {
    Serial.println("P2.5: "+String(p25));
    Serial.println("P10:  "+String(p10));
  }
delay(100);
}

here are the errors I'm getting

code:10: error: expected ')' before 'pin_rx'

 SDS011(byte pin_rx, byte pin_tx)  

             ^

C:\Users\Nick\Desktop\code\code.ino: In function 'void loop()':

code:26: error: 'p25' was not declared in this scope

   error = my_sds.read(&p25,&p10);

                        ^

code:26: error: 'p10' was not declared in this scope

   error = my_sds.read(&p25,&p10);

                             ^ 

exit status 1
expected ')' before 'pin_rx'

I'm fairly new to this and I'm having trouble with a code for a dust Dust sensor. Getting code with a couple of differentfew errors. I downloaded this code from github

I'm fairly new to this and I'm having trouble with a code for a dust sensor. Getting a couple of errors. I downloaded this code from github. Anyone have any idea to fix any of these errors? Any help is appreciated. Sorry if this formatted wrong, this is also my first post. Thanks for your time

// SDS011 dust sensor example
// -----------------------------
//
// By R. Zschiegner ([email protected]).
// April 2016

#include "SDS011.h"
#include<SoftwareSerial.h>
SoftwareSerial myserial(0, 1);
SDS011(byte pin_rx, byte pin_tx)  
float p10,p25;
int error;


SDS011 my_sds;

void setup() {
  my_sds.begin(0, 1);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
}

void loop() {
  error = my_sds.read(&p25,&p10);
  if (! error) {
    Serial.println("P2.5: "+String(p25));
    Serial.println("P10:  "+String(p10));
  }
delay(100);
}

here are the errors I'm getting

code:10: error: expected ')' before 'pin_rx'

SDS011(byte pin_rx, byte pin_tx)

         ^

C:\Users\Nick\Desktop\code\code.ino: In function 'void loop()':

code:26: error: 'p25' was not declared in this scope

error = my_sds.read(&p25,&p10);

                    ^

code:26: error: 'p10' was not declared in this scope

error = my_sds.read(&p25,&p10);

                         ^

exit status 1 expected ')' before 'pin_rx'

Sorry if this formatted wrong, this is also my first post. Thanks for your time

I'm fairly new to this and I'm having trouble with a code for a dust sensor. Getting a couple of different errors. I downloaded this code from github

// SDS011 dust sensor example
// -----------------------------
//
// By R. Zschiegner ([email protected]).
// April 2016

#include "SDS011.h"
#include<SoftwareSerial.h>
SoftwareSerial myserial(0, 1);
SDS011(byte pin_rx, byte pin_tx)  
float p10,p25;
int error;


SDS011 my_sds;

void setup() {
  my_sds.begin(0, 1);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
}

void loop() {
  error = my_sds.read(&p25,&p10);
  if (! error) {
    Serial.println("P2.5: "+String(p25));
    Serial.println("P10:  "+String(p10));
  }
delay(100);
}

here are the errors I'm getting

code:10: error: expected ')' before 'pin_rx'

SDS011(byte pin_rx, byte pin_tx)

         ^

C:\Users\Nick\Desktop\code\code.ino: In function 'void loop()':

code:26: error: 'p25' was not declared in this scope

error = my_sds.read(&p25,&p10);

                    ^

code:26: error: 'p10' was not declared in this scope

error = my_sds.read(&p25,&p10);

                         ^

exit status 1 expected ')' before 'pin_rx'

Sorry if this formatted wrong, this is also my first post. Thanks for your time

Dust sensor code with a few errors

I'm fairly new to this and I'm having trouble with a code for a dust sensor. Getting a couple of errors. I downloaded this code from github. Anyone have any idea to fix any of these errors? Any help is appreciated. Sorry if this formatted wrong, this is also my first post. Thanks for your time

// SDS011 dust sensor example
// -----------------------------
//
// By R. Zschiegner ([email protected]).
// April 2016

#include "SDS011.h"
#include<SoftwareSerial.h>
SoftwareSerial myserial(0, 1);
SDS011(byte pin_rx, byte pin_tx)  
float p10,p25;
int error;


SDS011 my_sds;

void setup() {
  my_sds.begin(0, 1);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
}

void loop() {
  error = my_sds.read(&p25,&p10);
  if (! error) {
    Serial.println("P2.5: "+String(p25));
    Serial.println("P10:  "+String(p10));
  }
delay(100);
}

here are the errors I'm getting

code:10: error: expected ')' before 'pin_rx'

SDS011(byte pin_rx, byte pin_tx)

         ^

C:\Users\Nick\Desktop\code\code.ino: In function 'void loop()':

code:26: error: 'p25' was not declared in this scope

error = my_sds.read(&p25,&p10);

                    ^

code:26: error: 'p10' was not declared in this scope

error = my_sds.read(&p25,&p10);

                         ^

exit status 1 expected ')' before 'pin_rx'

Source Link

I'm fairly new to this and I'm having trouble with a code for a dust sensor. Getting a couple of different errors. I downloaded this code from github

// SDS011 dust sensor example
// -----------------------------
//
// By R. Zschiegner ([email protected]).
// April 2016

#include "SDS011.h"
#include<SoftwareSerial.h>
SoftwareSerial myserial(0, 1);
SDS011(byte pin_rx, byte pin_tx)  
float p10,p25;
int error;


SDS011 my_sds;

void setup() {
  my_sds.begin(0, 1);
  Serial.begin(9600);
  while (!Serial) {
    ;
  }
}

void loop() {
  error = my_sds.read(&p25,&p10);
  if (! error) {
    Serial.println("P2.5: "+String(p25));
    Serial.println("P10:  "+String(p10));
  }
delay(100);
}

here are the errors I'm getting

code:10: error: expected ')' before 'pin_rx'

SDS011(byte pin_rx, byte pin_tx)

         ^

C:\Users\Nick\Desktop\code\code.ino: In function 'void loop()':

code:26: error: 'p25' was not declared in this scope

error = my_sds.read(&p25,&p10);

                    ^

code:26: error: 'p10' was not declared in this scope

error = my_sds.read(&p25,&p10);

                         ^

exit status 1 expected ')' before 'pin_rx'

Sorry if this formatted wrong, this is also my first post. Thanks for your time