-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathEasyNeoPixels.h
More file actions
30 lines (23 loc) · 811 Bytes
/
EasyNeoPixels.h
File metadata and controls
30 lines (23 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
EasyNeoPixels.h - Library for making neopixels more approachable.
Created by Evelyn Masso, April 9, 2017.
*/
#pragma once
#include "Arduino.h"
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel easyNeoPixels;
void setupEasyNeoPixels(int pin, int num) {
easyNeoPixels = Adafruit_NeoPixel(num, pin, NEO_GRB + NEO_KHZ800);
easyNeoPixels.begin();
}
// set the nth neopixel to a particular brightness of white
// meant to be used with val as HIGH or LOW
void writeEasyNeoPixel(int num, int val) {
easyNeoPixels.setPixelColor(num, easyNeoPixels.Color(val*255,val*255,val*255));
easyNeoPixels.show();
}
// set the nth neopixel to a particular rgb color
void writeEasyNeoPixel(int num, int r, int g, int b) {
easyNeoPixels.setPixelColor(num, easyNeoPixels.Color(r,g,b));
easyNeoPixels.show();
}