Skip to content
Snippets Groups Projects
LEDBehaviours.hpp 1.08 KiB
Newer Older
#ifndef LED_BEHAVIOUR_h
#define LED_BEHAVIOUR_h
#include "Arduino.h"
#include "Behaviours.h"

#include <Adafruit_NeoPixel.h>

Matthew's avatar
Matthew committed
class NumLEDs : public Behaviour
{
	Adafruit_NeoPixel* _strip;
	uint32_t _color;
Matthew's avatar
Matthew committed
	NumLEDs(Adafruit_NeoPixel* strip, String name = "NumLEDs", uint32_t color=0xFFFFFFFF);
	char* args();
Matthew's avatar
Matthew committed
	String start(String args);
Matthew's avatar
Matthew committed
class BrightnessLEDs : public Behaviour
{
	Adafruit_NeoPixel* _strip;
	uint32_t _hue;
	uint32_t _sat;
Matthew's avatar
Matthew committed
	BrightnessLEDs(Adafruit_NeoPixel* strip, String name = "BrightnessLEDs", uint32_t hue=0, uint32_t sat=0);
	char* args();
Matthew's avatar
Matthew committed
	String start(String args)
class BreathingLEDs : public Behaviour
{
Matthew's avatar
Matthew committed
	Adafruit_NeoPixel* _strip;
	uint _hue;
	uint _sat;
	int32_t _current = 0;
	 //Allows us to have slightly slower behaviours on the go...
	int _factor = 4;
	int _rate = 0;
	int _direction = 1;
Matthew's avatar
Matthew committed
	BreathingLEDs(Adafruit_NeoPixel* strip, String name = "BreathingLEDs", uint32_t hue=0, uint32_t sat=0) :
		Behaviour(name), _strip(strip), _hue(hue * 255), _sat(sat)
	{ }
	char* args();
Matthew's avatar
Matthew committed
	String start(String args);
Matthew's avatar
Matthew committed
	void update();