This repository has been archived by the owner on May 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from 107-systems/neopixel
added neopixel functions
- Loading branch information
Showing
3 changed files
with
154 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Software for the auxiliary controller for the L3X-Z Hexapod | ||
*/ | ||
|
||
/************************************************************************************** | ||
* INCLUDE | ||
**************************************************************************************/ | ||
|
||
#include "NeoPixelControl.h" | ||
|
||
/************************************************************************************** | ||
* CTOR/DTOR | ||
**************************************************************************************/ | ||
|
||
NeoPixelControl::NeoPixelControl(int const pin, int const num_pixels) | ||
: _pixels(num_pixels, pin, NEO_GRB) | ||
{ | ||
|
||
} | ||
|
||
/************************************************************************************** | ||
* PUBLIC MEMBER FUNCTIONS | ||
**************************************************************************************/ | ||
|
||
void NeoPixelControl::begin() | ||
{ | ||
_pixels.begin(); | ||
} | ||
|
||
void NeoPixelControl::light_off() | ||
{ | ||
_pixels.clear(); | ||
_pixels.show(); | ||
} | ||
|
||
void NeoPixelControl::light_green() | ||
{ | ||
_pixels.fill(_pixels.Color(0, 55, 0)); | ||
_pixels.show(); | ||
} | ||
|
||
void NeoPixelControl::light_red() | ||
{ | ||
_pixels.fill(_pixels.Color(55, 0, 0)); | ||
_pixels.show(); | ||
} | ||
|
||
void NeoPixelControl::light_blue() | ||
{ | ||
_pixels.fill(_pixels.Color(0, 0, 55)); | ||
_pixels.show(); | ||
} | ||
|
||
void NeoPixelControl::light_white() | ||
{ | ||
_pixels.fill(_pixels.Color(55, 55, 55)); | ||
_pixels.show(); | ||
} | ||
|
||
void NeoPixelControl::light_amber() | ||
{ | ||
_pixels.fill(_pixels.Color(55, 40, 0)); | ||
_pixels.show(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Software for the auxiliary controller for the L3X-Z Hexapod | ||
*/ | ||
|
||
#ifndef AUX_CTRL_NEO_PIXEL_CONTROL_H_ | ||
#define AUX_CTRL_NEO_PIXEL_CONTROL_H_ | ||
|
||
/************************************************************************************** | ||
* INCLUDE | ||
**************************************************************************************/ | ||
|
||
#include <Adafruit_NeoPixel.h> | ||
|
||
/************************************************************************************** | ||
* CLASS DEFINITION | ||
**************************************************************************************/ | ||
|
||
class NeoPixelControl | ||
{ | ||
public: | ||
|
||
NeoPixelControl(int const pin, int const num_pixels); | ||
|
||
|
||
void begin(); | ||
|
||
|
||
void light_off(); | ||
void light_green(); | ||
void light_red(); | ||
void light_blue(); | ||
void light_white(); | ||
void light_amber(); | ||
|
||
inline Adafruit_NeoPixel & pixels() { return _pixels; } | ||
|
||
|
||
private: | ||
Adafruit_NeoPixel _pixels; | ||
}; | ||
|
||
#endif /* AUX_CTRL_NEO_PIXEL_CONTROL_H_ */ |