Git Product home page Git Product logo

pxt-airquality's People

Contributors

ryanjmortenson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pxt-airquality's Issues

Microbit Package

The link to the package does not work. Is there an updated link to open the package in MakeCode?

Library only works if I -first- upload an Arduino program, and -then- transfer my MakeCode program

At first when using your library, I only got one static reading showing unrealistically high eCO2 values. Often at around 65000.

I then discovered the sensor works great with Arduino IDE and Sparkfun's CCS811 library. The eCO2 values stay at around 400, and increase significantly when I breathe on the sensor.

Finally, I discovered that your library does work! If I first transfer an Arduino sketch and then transfer my code with your MakeCode library, I get expected readings. If I pull the USB plug and put it back in, the readings go back to being static again.

Here are the respective error and status codes MakeCode gives me:
Successful readings: Error 0, status alternates between 144 and 152.
Unsuccessful readings: Error 3, status 16

Here's an example of a log, where you can see where the USB was pulled out and put back in. As you can see, the bottom line has been repeated 741 times:

Error: 0, status: 144, ppm: 415
Error: 0, status: 152, ppm: 415
4Error: 0, status: 144, ppm: 415
Error: 0, status: 152, ppm: 410
3Error: 0, status: 144, ppm: 410
Error: 0, status: 152, ppm: 410
2Error: 0, status: 144, ppm: 410
741Error: 3, status: 16, ppm: 4349

My Arduino program:

#include <Wire.h>
#include "SparkFunCCS811.h"
CCS811 mySensor(0x5B);

void setup()
{
  Serial.begin(9600);
  Wire.begin();
  CCS811Core::status returnCode = mySensor.begin();
}

void loop()
{
  if (mySensor.dataAvailable())
  {
    mySensor.readAlgorithmResults();
    Serial.println(mySensor.getCO2());
  }
  delay(10);
}

My MakeCode program:

airQuality.setAddress(CCS811_I2C_ADDRESS.ADDR_0x5B)

basic.forever(function () {
    serial.writeLine(`Error: ${airQuality.readError()}, status: ${airQuality.readStatus()}, ppm: ${airQuality.readCo2()}`)
})

The sensor has been connected using 3.3V, GND, SDA and SCL.

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.