Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Broken link to CCS811 Library for CircuitPython
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Broken link to CCS811 Library for CircuitPython

by jerryn on Tue Aug 08, 2017 10:19 pm

The tutorial for the CCS811 sensor: https://learn.adafruit.com/adafruit-ccs811-air-quality-sensor
links to a library for Circuit python, but clicking on the link gives a "404" error.
the link is:
https://github.com/adafruit/Adafruit_CircuitPython_CCS811

To begin reading sensor data, you will need to download Adafruit_CircuitPython_CCS811 from our github repository. You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip


I was not able to find the library by searching the Adafruit Github repository.

Does it exist?

Thanks

jerryn
 
Posts: 1341
Joined: Sat Sep 14, 2013 9:05 am

Re: Broken link to CCS811 Library for CircuitPython

by adafruit2 on Wed Aug 09, 2017 1:03 pm

woops its live now!

adafruit2
Site Admin
 
Posts: 19408
Joined: Fri Mar 11, 2005 7:36 pm

Re: Broken link to CCS811 Library for CircuitPython

by jerryn on Wed Aug 09, 2017 4:07 pm

Thanks! Got it. Will test it later this evening.

jerryn
 
Posts: 1341
Joined: Sat Sep 14, 2013 9:05 am

Re: Broken link to CCS811 Library for CircuitPython

by jerryn on Wed Aug 09, 2017 8:30 pm

one minor problem - I created an issue on Github but the problem was with this section of the library.

Code: Select all | TOGGLE FULL SIZE
         #check that the HW id is correct
      if self.hw_id != CCS811_HW_ID_CODE:
         raise RuntimeException("Device ID returned is not correct! Please check your wiring.")
      
      #try to start the app
      buf = bytearray(1)
      buf[0] = 0xF4
      self.i2c_device.write(buf, end=1, stop=True)
      time.sleep(.1)
      
      #make sure there are no errors and we have entered application mode
      if self.checkError():
         raise RuntimeException("Device returned an Error! Try removing and reapplying power to the device and running the code again.")
      if not self.fw_mode:
         raise RuntimeException("Device did not enter application mode! If you got here, there may be a problem with the firmware on your sensor.")


in CurcuitPython RuntimeException is not defined - this should be just Exception.
I think I only saw this because of a wiring issue that triggered the error!

Replacing the 3 RuntimeException calls with Exception fixed it and it is working now.
I tested it on CircuitPython 2.0.0-beta-1.1 but I think it is the same in 1.0.0.

Thanks for providing the library (and letting me have some fun ;-)

jerryn
 
Posts: 1341
Joined: Sat Sep 14, 2013 9:05 am

Re: Broken link to CCS811 Library for CircuitPython

by tannewt on Wed Aug 09, 2017 9:13 pm

I mistakenly suggested RuntimeException but it should be RuntimeError. :-/ Oops! jerry do you know how to submit a pull request to get it fixed?

tannewt
 
Posts: 1853
Joined: Thu Oct 06, 2016 8:48 pm

Re: Broken link to CCS811 Library for CircuitPython

by jerryn on Wed Aug 09, 2017 9:22 pm

Should it be RuntimeError or Exception?
I tried Exception and it seems to work but I can try RuntimeError as well.
I have never done a pull, but I'll be happy to give it a try.


I tried RuntimeError and it works as well - I'll make that change and try initiating a pull request.

jerryn
 
Posts: 1341
Joined: Sat Sep 14, 2013 9:05 am

Please be positive and constructive with your questions and comments.