adatadate / pxt-airquality Goto Github PK
View Code? Open in Web Editor NEWMakecode Package for the CCS811 Air Quality Sensor
License: MIT License
Makecode Package for the CCS811 Air Quality Sensor
License: MIT License
The link to the package does not work. Is there an updated link to open the package in MakeCode?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.