jadenaccord / CCS811-HDC1080

Code to read CCS811 and HDC1080 data from CJMCU-8118, print it to serial monitor and save it to .csv file.
2 stars 3 forks source link

Unable to compile sketch #1

Closed t3ch9 closed 4 years ago

t3ch9 commented 4 years ago

Hello, getting the following error when I try to compile the sketch:

Arduino: 1.8.12 (Windows 7), Board: "Arduino Uno"

C:\Users\admin\Documents\Arduino\CCS811-HDC1080\CCS811-HDC1080.ino: In function 'void loop()':

CCS811-HDC1080:113:5: error: expected primary-expression before '}' token

 }

 ^

exit status 1 expected primary-expression before '}' token

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

jadenaccord commented 4 years ago

I was unable to reproduce this error. When I tried to compile this (on both my Windows and Linux machine), the code compiles with no errors.

Would you mind pasting the entire loop function from your local file, so I can check that your syntax is not slightly different than mine? The error suggests that there might be a '}' too little or too many.

t3ch9 commented 4 years ago

Its the same exact code copy/paste from your ino file.

One thing that I noticed is that on line 106 is missing a closing parenthesis.

If possible, please upload the ino file that you are using on your local machine.

jadenaccord commented 4 years ago

You're completely right. I didn't notice that I fixed that missing closing parenthesis on line 106, but didn't commit it. There's also a missing semicolon on line 112.

I fixed those and making a pull request now.

t3ch9 commented 4 years ago

I updated my sketch based on the corrections in your previous comment. Now I am able to compile the sketch, however in serial console I get: Failed to start sensor! Please check your wiring.

Are you using the same exact wiring on your Arduino as the Wemos D1 / ESP32 wiring on CJMCU-8118_InfluxDB ?

If not, which wiring are you using on your Arduino?

jadenaccord commented 4 years ago

I wired it like so:

This is because the I2C protocol only works on analog pinouts 4 and 5 on the Arduino Uno, not the digital pinouts 1 and 2 like on the Wemos D1.

t3ch9 commented 4 years ago

Your wiring works on my Arduino...now getting the sensor readings on my serial monitor. Thank you.

Did you have to calibrate or do anything special to this sensor?

jadenaccord commented 4 years ago

There is no calibration required, but I have found the measurements to become more stable after waiting maybe 20 minutes.

According to this thread about reliability between bfaliszek (whose code I based this on) and maarten-pennings (who also wrote a library for the CCS811), giving the sensor about a week will make it more stable. I haven't had it running for that long without interruption, so I can't personally attest to that.

That same thread also has some mentions of firmware updates. I personally have not tried that yet either, but it might be worth it if you want better measurements.

I hope this helps. And if you don't mind me asking, how did you find this repository? Via Google, GitHub search, or something else?

t3ch9 commented 4 years ago

I found this repo via GitHub search. Thank you for all your feedback.