Neale Pickett
·
2016-10-02
Synchrotron.h
1#pragma once
2#include <Arduino.h>
3#include <Adafruit_NeoPixel.h>
4
5
6class Synchrotron {
7 Adafruit_NeoPixel *pxl;
8 uint16_t npixels; // How many pixels there are
9 int cur; // Which pixel the synchrotron is on, currently
10 int tickrate; // How many millis between pixel position changes
11 int ticks; // How many ticks have elapsed since last position change
12 byte r, g, b; // Current color
13
14 int transition_length, transition_elapsed;
15 int initial_tickrate, initial_r, initial_g, initial_b;
16 float dtickrate, dr, dg, db;
17 float ftickrate;
18public:
19 Synchrotron(uint16_t n, uint8_t p=6, neoPixelType t=NEO_GRB + NEO_KHZ800);
20 transition(int duration, int final_tickrate, byte final_r, byte final_g, byte final_b);
21 bool transitioned();
22 float speed();
23 standby();
24 charge();
25 fire();
26 discharge();
27 tick(unsigned long jiffies); // Try to call this every jiffy
28};