Thanks for the help with the links, I wasn't aware. This is the code I have at the moment. When uploaded it spins the fan of the sensor and the first two LEDs on the ring light up white, I'm not sure what the issues are...
// Target: Arduino UNO
// SDS011 on Serial
#include "SoftwareSerial.h"
SoftwareSerial mySerial(2, 3); // RX, TX for SDS011 sensor ( to keep Serial monitor available )
// 24 LED ring
#include <Adafruit_NeoPixel.h>
#define PIN 6 // On Trinket or Gemma, suggest changing this to 1
#define NUMPIXELS 24 // Popular NeoPixel ring size
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// colors for 3 bands; green, yellow, red, and each band increases in brightness
const uint32_t color_table[NUMPIXELS] =
{ pixels.Color( 0, 2, 0 ), pixels.Color( 0, 4, 0 ), pixels.Color( 0, 6, 0 ), pixels.Color( 0, 8, 0 ), pixels.Color( 0, 10, 0 ), pixels.Color( 0, 12, 0 ), pixels.Color( 0, 14, 0 ), pixels.Color( 0, 16, 0 ), // green band
pixels.Color( 2, 2, 0 ), pixels.Color( 4, 4, 0 ), pixels.Color( 6, 6, 0 ), pixels.Color( 8, 8, 0 ), pixels.Color( 10, 10, 0 ), pixels.Color( 12, 12, 0 ), pixels.Color( 14, 14, 0 ), pixels.Color( 16, 16, 0 ), // yellow band
pixels.Color( 2, 0, 0 ), pixels.Color( 4, 0, 0 ), pixels.Color( 6, 0, 0 ), pixels.Color( 8, 0, 0 ), pixels.Color( 10, 0, 0 ), pixels.Color( 12, 0, 0 ), pixels.Color( 14, 0, 0 ), pixels.Color( 16, 0, 0 ), // red band
};
void setup()
{
mySerial.begin(9600); // SDS011
mySerial.setTimeout(200);
}
void loop()
{
// Read SDS011
unsigned char buffSDS[25];
mySerial.readBytesUntil(0xAB, buffSDS, 20);
unsigned int PM2_5 = ((buffSDS[3] * 256) + buffSDS[2]) / 10; // extract PM2.5 value
unsigned int PM10 = ((buffSDS[5] * 256) + buffSDS[4]) / 10; // extract PM10 value
// map sensor to display
int num_pixels_on;
num_pixels_on = map( PM2_5, 0, 999, 0, 24 );
num_pixels_on = constrain( num_pixels_on, 0, 24 );
// render on display
pixels.clear(); // Set all pixel colors to 'off'
for (int i = 0; i < num_pixels_on; i++)
pixels.setPixelColor(i, color_table[ i ]);
pixels.show();
}