Arduino Project – Digitally Controlled Analog Surround Sound Panning – Open Source

For your enjoyment:

Digitally Controlled Analog Surround Sound Panning

 

Presentation:

 

Circuit Explination:

 

Presentation documents:

0 – TPJ – Technical Presentation

0 – TPJ556-FINAL report DCASSP-COMPLETE

0 – TPJ556-FINAL report DCASSP-SCHEMATICS V1

 

 

Project Source Code:

 


#include <Adafruit_NeoPixel.h>
#include <Wire.h>

//Anthony P. Kuzub

// Neopixels ATTACHED TO THESE PINS
#define FNT_NEO_PIXEL_PIN 48

//Number of Neopixels ATTACHED TO THESE PINS
#define N_PIXELS 5

//neopixel Index nick names. 0 is the bottom NEOPIXEL in the line
#define FNT_NEO_PIXEL_SEL 4
#define FNT_NEO_PIXEL_SUN 3
#define FNT_NEO_PIXEL_SKY 2
#define FNT_NEO_PIXEL_GRASS 1
#define FNT_NEO_PIXEL_EARTH 0

//LED Lights ATTACHED TO THESE PINS
#define FDR_LED_KEY_CHON_PIN 25
#define FDR_LED_KEY_ONLY_PIN 22
#define FDR_LED_KEY_SEL_PIN 23
#define FNT_LED_KEY_EARTH_PIN 39
#define FNT_LED_KEY_GRASS_PIN 41
#define FNT_LED_KEY_SEL_PIN 50
#define FNT_LED_KEY_SKY_PIN 49
#define FNT_LED_KEY_SUN_PIN 51

//Potentionmeters ATTACHED TO THESE PINS
#define FNT_POT_SUN_PIN A0
#define FNT_POT_SKY_PIN A1
#define FNT_POT_GRASS_PIN A6
#define FNT_POT_EARTH_PIN A12
#define FDR_POT_POSITION_PIN A14
#define FDR_POT_SLIDE_PIN A15

// KEYS ATTACHED TO THESE PINS
#define FDR_KEY_CHON_PIN 27
#define FDR_KEY_ONLY_PIN 31
#define FDR_KEY_SEL_PIN 29
#define FNT_KEY_EARTH_PIN 37
#define FNT_KEY_GRASS_PIN 35
#define FNT_KEY_SEL_PIN 52
#define FNT_KEY_SKY_PIN 47
#define FNT_KEY_SUN_PIN 45

//POT VALUES
int FNT_POT_EARTH_STATE;
int FNT_POT_GRASS_STATE;
int FNT_POT_SKY_STATE;
int FNT_POT_SUN_STATE;
int FDR_POT_POSITION_STATE;
int FDR_POT_SLIDE_STATE;

int FDR_POT_POSITION_CHANGE;
int FDR_POT_SLIDE_CHANGE;

//POT SCALERS
byte FNT_POT_EARTH_SCALE;
byte FNT_POT_GRASS_SCALE;
byte FNT_POT_SKY_SCALE;
byte FNT_POT_SUN_SCALE;
byte FDR_POT_POSITION_SCALE;
byte FDR_POT_SLIDE_SCALE;

//FADER LED PANEL
int FDR_LED_KEY_CHON_STATE = 1;
int FDR_LED_KEY_ONLY_STATE = 1 ;
int FDR_LED_KEY_SEL_STATE = 1;

// FADER KEY
int FDR_KEY_CHON_STATE;
int FDR_KEY_ONLY_STATE;
int FDR_KEY_SEL_STATE;

// FADER KEY
int FDR_KEY_CHON_LAST_STATE;
int FDR_KEY_ONLY_LAST_STATE;
int FDR_KEY_SEL_LAST_STATE;

// FRONT LED
int FNT_LED_KEY_EARTH_STATE = 1 ;
int FNT_LED_KEY_GRASS_STATE = 1;
int FNT_LED_KEY_SEL_STATE = 1;
int FNT_LED_KEY_SKY_STATE = 1;
int FNT_LED_KEY_SUN_STATE = 1;

//FRONT KEYS
int FNT_KEY_EARTH_STATE ;
int FNT_KEY_GRASS_STATE ;
int FNT_KEY_SEL_STATE ;
int FNT_KEY_SKY_STATE ;
int FNT_KEY_SUN_STATE ;

//FRONT KEYS
int FNT_KEY_EARTH_LAST_STATE ;
int FNT_KEY_GRASS_LAST_STATE ;
int FNT_KEY_SEL_LAST_STATE ;
int FNT_KEY_SKY_LAST_STATE ;
int FNT_KEY_SUN_LAST_STATE ;

//Digital POTS
byte attenuation = 32; // Attenuation value of volume potentiometer gangs. Initially set to minimum volume.
byte tempattenuation = 0; // Holds attenuation value for second pot bitwise operation
byte PotScaler = 63;

Adafruit_NeoPixel FNT_NEO_PIXEL = Adafruit_NeoPixel(N_PIXELS, FNT_NEO_PIXEL_PIN, NEO_GRB + NEO_KHZ800);

//Debounce times
long lastDebounceTime = 0; // the last time the output pin was toggled
long debounceDelay = 2; // the debounce time; increase if the output flickers
int buttonState; // the current reading from the input pin
int lastButtonState = LOW; // the previous reading from the input pin

int StateMachinePodSelect = 1;
int StateMachinePodInput=0;

byte readingSUN, readingSKY, readingGRASS, readingEARTH;

/*The five pointNone array takes an index value from 0 to 1023 and performs a look up from
math pre-solved. By Looking up the pre-solved math the microcontrollers performes minimal calculations
This array stores the behavior of the Positioning. By indexing [A] is the position
Indexing [b] is the value at the channel
*/
byte fivepoint[1024][5] = {
{64, 0, 0, 0, 0},
{63, 0, 0, 0, 0},
{63, 0, 0, 0, 0},
{63, 1, 0, 0, 0},
{63, 1, 0, 0, 0},
{63, 2, 0, 0, 0},
{63, 2, 0, 0, 0},
{63, 3, 0, 0, 0},
{63, 3, 0, 0, 0},
{63, 4, 0, 0, 0},
{63, 4, 0, 0, 0},
{63, 5, 0, 0, 0},
{63, 5, 0, 0, 0},
{63, 6, 0, 0, 0},
{63, 6, 0, 0, 0},
{63, 7, 0, 0, 0},
{63, 7, 0, 0, 0},
{63, 8, 0, 0, 0},
{63, 8, 0, 0, 0},
{63, 9, 0, 0, 0},
{63, 9, 0, 0, 0},
{63, 10, 0, 0, 0},
{63, 10, 0, 0, 0},
{63, 10, 0, 0, 0},
{63, 11, 0, 0, 0},
{63, 11, 0, 0, 0},
{63, 12, 0, 0, 0},
{63, 12, 0, 0, 0},
{63, 13, 0, 0, 0},
{63, 13, 0, 0, 0},
{63, 14, 0, 0, 0},
{63, 14, 0, 0, 0},
{63, 15, 0, 0, 0},
{62, 15, 0, 0, 0},
{62, 15, 0, 0, 0},
{62, 16, 0, 0, 0},
{62, 16, 0, 0, 0},
{62, 17, 0, 0, 0},
{62, 17, 0, 0, 0},
{62, 18, 0, 0, 0},
{62, 18, 0, 0, 0},
{62, 18, 0, 0, 0},
{62, 19, 0, 0, 0},
{62, 19, 0, 0, 0},
{62, 20, 0, 0, 0},
{62, 20, 0, 0, 0},
{61, 20, 0, 0, 0},
{61, 21, 0, 0, 0},
{61, 21, 0, 0, 0},
{61, 22, 0, 0, 0},
{61, 22, 0, 0, 0},
{61, 22, 0, 0, 0},
{61, 23, 0, 0, 0},
{61, 23, 0, 0, 0},
{61, 24, 0, 0, 0},
{61, 24, 0, 0, 0},
{60, 24, 0, 0, 0},
{60, 25, 0, 0, 0},
{60, 25, 0, 0, 0},
{60, 26, 0, 0, 0},
{60, 26, 0, 0, 0},
{60, 26, 0, 0, 0},
{60, 27, 0, 0, 0},
{60, 27, 0, 0, 0},
{60, 28, 0, 0, 0},
{59, 28, 0, 0, 0},
{59, 28, 0, 0, 0},
{59, 29, 0, 0, 0},
{59, 29, 0, 0, 0},
{59, 29, 0, 0, 0},
{59, 30, 0, 0, 0},
{59, 30, 0, 0, 0},
{58, 30, 0, 0, 0},
{58, 31, 0, 0, 0},
{58, 31, 0, 0, 0},
{58, 32, 0, 0, 0},
{58, 32, 0, 0, 0},
{58, 32, 0, 0, 0},
{58, 33, 0, 0, 0},
{57, 33, 0, 0, 0},
{57, 33, 0, 0, 0},
{57, 34, 0, 0, 0},
{57, 34, 0, 0, 0},
{57, 34, 0, 0, 0},
{57, 35, 0, 0, 0},
{56, 35, 0, 0, 0},
{56, 35, 0, 0, 0},
{56, 36, 0, 0, 0},
{56, 36, 0, 0, 0},
{56, 36, 0, 0, 0},
{56, 37, 0, 0, 0},
{55, 37, 0, 0, 0},
{55, 37, 0, 0, 0},
{55, 38, 0, 0, 0},
{55, 38, 0, 0, 0},
{55, 38, 0, 0, 0},
{55, 39, 0, 0, 0},
{54, 39, 0, 0, 0},
{54, 39, 0, 0, 0},
{54, 39, 0, 0, 0},
{54, 40, 0, 0, 0},
{54, 40, 0, 0, 0},
{53, 40, 0, 0, 0},
{53, 41, 0, 0, 0},
{53, 41, 0, 0, 0},
{53, 41, 0, 0, 0},
{53, 42, 0, 0, 0},
{52, 42, 0, 0, 0},
{52, 42, 0, 0, 0},
{52, 42, 0, 0, 0},
{52, 43, 0, 0, 0},
{51, 43, 0, 0, 0},
{51, 43, 0, 0, 0},
{51, 44, 0, 0, 0},
{51, 44, 0, 0, 0},
{51, 44, 0, 0, 0},
{50, 44, 0, 0, 0},
{50, 45, 0, 0, 0},
{50, 45, 0, 0, 0},
{50, 45, 0, 0, 0},
{49, 45, 0, 0, 0},
{49, 46, 0, 0, 0},
{49, 46, 0, 0, 0},
{49, 46, 0, 0, 0},
{48, 46, 0, 0, 0},
{48, 47, 0, 0, 0},
{48, 47, 0, 0, 0},
{48, 47, 0, 0, 0},
{48, 48, 0, 0, 0},
{47, 48, 0, 0, 0},
{47, 48, 0, 0, 0},
{47, 48, 0, 0, 0},
{46, 48, 0, 0, 0},
{46, 49, 0, 0, 0},
{46, 49, 0, 0, 0},
{46, 49, 0, 0, 0},
{45, 49, 0, 0, 0},
{45, 50, 0, 0, 0},
{45, 50, 0, 0, 0},
{45, 50, 0, 0, 0},
{44, 50, 0, 0, 0},
{44, 51, 0, 0, 0},
{44, 51, 0, 0, 0},
{44, 51, 0, 0, 0},
{43, 51, 0, 0, 0},
{43, 51, 0, 0, 0},
{43, 52, 0, 0, 0},
{42, 52, 0, 0, 0},
{42, 52, 0, 0, 0},
{42, 52, 0, 0, 0},
{42, 53, 0, 0, 0},
{41, 53, 0, 0, 0},
{41, 53, 0, 0, 0},
{41, 53, 0, 0, 0},
{40, 53, 0, 0, 0},
{40, 54, 0, 0, 0},
{40, 54, 0, 0, 0},
{39, 54, 0, 0, 0},
{39, 54, 0, 0, 0},
{39, 54, 0, 0, 0},
{39, 55, 0, 0, 0},
{38, 55, 0, 0, 0},
{38, 55, 0, 0, 0},
{38, 55, 0, 0, 0},
{37, 55, 0, 0, 0},
{37, 55, 0, 0, 0},
{37, 56, 0, 0, 0},
{36, 56, 0, 0, 0},
{36, 56, 0, 0, 0},
{36, 56, 0, 0, 0},
{35, 56, 0, 0, 0},
{35, 56, 0, 0, 0},
{35, 57, 0, 0, 0},
{34, 57, 0, 0, 0},
{34, 57, 0, 0, 0},
{34, 57, 0, 0, 0},
{33, 57, 0, 0, 0},
{33, 57, 0, 0, 0},
{33, 58, 0, 0, 0},
{32, 58, 0, 0, 0},
{32, 58, 0, 0, 0},
{32, 58, 0, 0, 0},
{31, 58, 0, 0, 0},
{31, 58, 0, 0, 0},
{30, 58, 0, 0, 0},
{30, 59, 0, 0, 0},
{30, 59, 0, 0, 0},
{29, 59, 0, 0, 0},
{29, 59, 0, 0, 0},
{29, 59, 0, 0, 0},
{28, 59, 0, 0, 0},
{28, 59, 0, 0, 0},
{28, 60, 0, 0, 0},
{27, 60, 0, 0, 0},
{27, 60, 0, 0, 0},
{26, 60, 0, 0, 0},
{26, 60, 0, 0, 0},
{26, 60, 0, 0, 0},
{25, 60, 0, 0, 0},
{25, 60, 0, 0, 0},
{24, 60, 0, 0, 0},
{24, 61, 0, 0, 0},
{24, 61, 0, 0, 0},
{23, 61, 0, 0, 0},
{23, 61, 0, 0, 0},
{22, 61, 0, 0, 0},
{22, 61, 0, 0, 0},
{22, 61, 0, 0, 0},
{21, 61, 0, 0, 0},
{21, 61, 0, 0, 0},
{20, 61, 0, 0, 0},
{20, 62, 0, 0, 0},
{20, 62, 0, 0, 0},
{19, 62, 0, 0, 0},
{19, 62, 0, 0, 0},
{18, 62, 0, 0, 0},
{18, 62, 0, 0, 0},
{18, 62, 0, 0, 0},
{17, 62, 0, 0, 0},
{17, 62, 0, 0, 0},
{16, 62, 0, 0, 0},
{16, 62, 0, 0, 0},
{15, 62, 0, 0, 0},
{15, 62, 0, 0, 0},
{15, 63, 0, 0, 0},
{14, 63, 0, 0, 0},
{14, 63, 0, 0, 0},
{13, 63, 0, 0, 0},
{13, 63, 0, 0, 0},
{12, 63, 0, 0, 0},
{12, 63, 0, 0, 0},
{11, 63, 0, 0, 0},
{11, 63, 0, 0, 0},
{10, 63, 0, 0, 0},
{10, 63, 0, 0, 0},
{10, 63, 0, 0, 0},
{9, 63, 0, 0, 0},
{9, 63, 0, 0, 0},
{8, 63, 0, 0, 0},
{8, 63, 0, 0, 0},
{7, 63, 0, 0, 0},
{7, 63, 0, 0, 0},
{6, 63, 0, 0, 0},
{6, 63, 0, 0, 0},
{5, 63, 0, 0, 0},
{5, 63, 0, 0, 0},
{4, 63, 0, 0, 0},
{4, 63, 0, 0, 0},
{3, 63, 0, 0, 0},
{3, 63, 0, 0, 0},
{2, 63, 0, 0, 0},
{2, 63, 0, 0, 0},
{1, 63, 0, 0, 0},
{1, 63, 0, 0, 0},
{0, 63, 0, 0, 0},
{0, 63, 0, 0, 0},
{0, 64, 0, 0, 0},
{0, 63, 0, 0, 0},
{0, 63, 0, 0, 0},
{0, 63, 1, 0, 0},
{0, 63, 1, 0, 0},
{0, 63, 2, 0, 0},
{0, 63, 2, 0, 0},
{0, 63, 3, 0, 0},
{0, 63, 3, 0, 0},
{0, 63, 4, 0, 0},
{0, 63, 4, 0, 0},
{0, 63, 5, 0, 0},
{0, 63, 5, 0, 0},
{0, 63, 6, 0, 0},
{0, 63, 6, 0, 0},
{0, 63, 7, 0, 0},
{0, 63, 7, 0, 0},
{0, 63, 8, 0, 0},
{0, 63, 8, 0, 0},
{0, 63, 9, 0, 0},
{0, 63, 9, 0, 0},
{0, 63, 10, 0, 0},
{0, 63, 10, 0, 0},
{0, 63, 10, 0, 0},
{0, 63, 11, 0, 0},
{0, 63, 11, 0, 0},
{0, 63, 12, 0, 0},
{0, 63, 12, 0, 0},
{0, 63, 13, 0, 0},
{0, 63, 13, 0, 0},
{0, 63, 14, 0, 0},
{0, 63, 14, 0, 0},
{0, 63, 15, 0, 0},
{0, 62, 15, 0, 0},
{0, 62, 15, 0, 0},
{0, 62, 16, 0, 0},
{0, 62, 16, 0, 0},
{0, 62, 17, 0, 0},
{0, 62, 17, 0, 0},
{0, 62, 18, 0, 0},
{0, 62, 18, 0, 0},
{0, 62, 18, 0, 0},
{0, 62, 19, 0, 0},
{0, 62, 19, 0, 0},
{0, 62, 20, 0, 0},
{0, 62, 20, 0, 0},
{0, 61, 20, 0, 0},
{0, 61, 21, 0, 0},
{0, 61, 21, 0, 0},
{0, 61, 22, 0, 0},
{0, 61, 22, 0, 0},
{0, 61, 22, 0, 0},
{0, 61, 23, 0, 0},
{0, 61, 23, 0, 0},
{0, 61, 24, 0, 0},
{0, 61, 24, 0, 0},
{0, 60, 24, 0, 0},
{0, 60, 25, 0, 0},
{0, 60, 25, 0, 0},
{0, 60, 26, 0, 0},
{0, 60, 26, 0, 0},
{0, 60, 26, 0, 0},
{0, 60, 27, 0, 0},
{0, 60, 27, 0, 0},
{0, 60, 28, 0, 0},
{0, 59, 28, 0, 0},
{0, 59, 28, 0, 0},
{0, 59, 29, 0, 0},
{0, 59, 29, 0, 0},
{0, 59, 29, 0, 0},
{0, 59, 30, 0, 0},
{0, 59, 30, 0, 0},
{0, 58, 30, 0, 0},
{0, 58, 31, 0, 0},
{0, 58, 31, 0, 0},
{0, 58, 32, 0, 0},
{0, 58, 32, 0, 0},
{0, 58, 32, 0, 0},
{0, 58, 33, 0, 0},
{0, 57, 33, 0, 0},
{0, 57, 33, 0, 0},
{0, 57, 34, 0, 0},
{0, 57, 34, 0, 0},
{0, 57, 34, 0, 0},
{0, 57, 35, 0, 0},
{0, 56, 35, 0, 0},
{0, 56, 35, 0, 0},
{0, 56, 36, 0, 0},
{0, 56, 36, 0, 0},
{0, 56, 36, 0, 0},
{0, 56, 37, 0, 0},
{0, 55, 37, 0, 0},
{0, 55, 37, 0, 0},
{0, 55, 38, 0, 0},
{0, 55, 38, 0, 0},
{0, 55, 38, 0, 0},
{0, 55, 39, 0, 0},
{0, 54, 39, 0, 0},
{0, 54, 39, 0, 0},
{0, 54, 39, 0, 0},
{0, 54, 40, 0, 0},
{0, 54, 40, 0, 0},
{0, 53, 40, 0, 0},
{0, 53, 41, 0, 0},
{0, 53, 41, 0, 0},
{0, 53, 41, 0, 0},
{0, 53, 42, 0, 0},
{0, 52, 42, 0, 0},
{0, 52, 42, 0, 0},
{0, 52, 42, 0, 0},
{0, 52, 43, 0, 0},
{0, 51, 43, 0, 0},
{0, 51, 43, 0, 0},
{0, 51, 44, 0, 0},
{0, 51, 44, 0, 0},
{0, 51, 44, 0, 0},
{0, 50, 44, 0, 0},
{0, 50, 45, 0, 0},
{0, 50, 45, 0, 0},
{0, 50, 45, 0, 0},
{0, 49, 45, 0, 0},
{0, 49, 46, 0, 0},
{0, 49, 46, 0, 0},
{0, 49, 46, 0, 0},
{0, 48, 46, 0, 0},
{0, 48, 47, 0, 0},
{0, 48, 47, 0, 0},
{0, 48, 47, 0, 0},
{0, 48, 48, 0, 0},
{0, 47, 48, 0, 0},
{0, 47, 48, 0, 0},
{0, 47, 48, 0, 0},
{0, 46, 48, 0, 0},
{0, 46, 49, 0, 0},
{0, 46, 49, 0, 0},
{0, 46, 49, 0, 0},
{0, 45, 49, 0, 0},
{0, 45, 50, 0, 0},
{0, 45, 50, 0, 0},
{0, 45, 50, 0, 0},
{0, 44, 50, 0, 0},
{0, 44, 51, 0, 0},
{0, 44, 51, 0, 0},
{0, 44, 51, 0, 0},
{0, 43, 51, 0, 0},
{0, 43, 51, 0, 0},
{0, 43, 52, 0, 0},
{0, 42, 52, 0, 0},
{0, 42, 52, 0, 0},
{0, 42, 52, 0, 0},
{0, 42, 53, 0, 0},
{0, 41, 53, 0, 0},
{0, 41, 53, 0, 0},
{0, 41, 53, 0, 0},
{0, 40, 53, 0, 0},
{0, 40, 54, 0, 0},
{0, 40, 54, 0, 0},
{0, 39, 54, 0, 0},
{0, 39, 54, 0, 0},
{0, 39, 54, 0, 0},
{0, 39, 55, 0, 0},
{0, 38, 55, 0, 0},
{0, 38, 55, 0, 0},
{0, 38, 55, 0, 0},
{0, 37, 55, 0, 0},
{0, 37, 55, 0, 0},
{0, 37, 56, 0, 0},
{0, 36, 56, 0, 0},
{0, 36, 56, 0, 0},
{0, 36, 56, 0, 0},
{0, 35, 56, 0, 0},
{0, 35, 56, 0, 0},
{0, 35, 57, 0, 0},
{0, 34, 57, 0, 0},
{0, 34, 57, 0, 0},
{0, 34, 57, 0, 0},
{0, 33, 57, 0, 0},
{0, 33, 57, 0, 0},
{0, 33, 58, 0, 0},
{0, 32, 58, 0, 0},
{0, 32, 58, 0, 0},
{0, 32, 58, 0, 0},
{0, 31, 58, 0, 0},
{0, 31, 58, 0, 0},
{0, 30, 58, 0, 0},
{0, 30, 59, 0, 0},
{0, 30, 59, 0, 0},
{0, 29, 59, 0, 0},
{0, 29, 59, 0, 0},
{0, 29, 59, 0, 0},
{0, 28, 59, 0, 0},
{0, 28, 59, 0, 0},
{0, 28, 60, 0, 0},
{0, 27, 60, 0, 0},
{0, 27, 60, 0, 0},
{0, 26, 60, 0, 0},
{0, 26, 60, 0, 0},
{0, 26, 60, 0, 0},
{0, 25, 60, 0, 0},
{0, 25, 60, 0, 0},
{0, 24, 60, 0, 0},
{0, 24, 61, 0, 0},
{0, 24, 61, 0, 0},
{0, 23, 61, 0, 0},
{0, 23, 61, 0, 0},
{0, 22, 61, 0, 0},
{0, 22, 61, 0, 0},
{0, 22, 61, 0, 0},
{0, 21, 61, 0, 0},
{0, 21, 61, 0, 0},
{0, 20, 61, 0, 0},
{0, 20, 62, 0, 0},
{0, 20, 62, 0, 0},
{0, 19, 62, 0, 0},
{0, 19, 62, 0, 0},
{0, 18, 62, 0, 0},
{0, 18, 62, 0, 0},
{0, 18, 62, 0, 0},
{0, 17, 62, 0, 0},
{0, 17, 62, 0, 0},
{0, 16, 62, 0, 0},
{0, 16, 62, 0, 0},
{0, 15, 62, 0, 0},
{0, 15, 62, 0, 0},
{0, 15, 63, 0, 0},
{0, 14, 63, 0, 0},
{0, 14, 63, 0, 0},
{0, 13, 63, 0, 0},
{0, 13, 63, 0, 0},
{0, 12, 63, 0, 0},
{0, 12, 63, 0, 0},
{0, 11, 63, 0, 0},
{0, 11, 63, 0, 0},
{0, 10, 63, 0, 0},
{0, 10, 63, 0, 0},
{0, 10, 63, 0, 0},
{0, 9, 63, 0, 0},
{0, 9, 63, 0, 0},
{0, 8, 63, 0, 0},
{0, 8, 63, 0, 0},
{0, 7, 63, 0, 0},
{0, 7, 63, 0, 0},
{0, 6, 63, 0, 0},
{0, 6, 63, 0, 0},
{0, 5, 63, 0, 0},
{0, 5, 63, 0, 0},
{0, 4, 63, 0, 0},
{0, 4, 63, 0, 0},
{0, 3, 63, 0, 0},
{0, 3, 63, 0, 0},
{0, 2, 63, 0, 0},
{0, 2, 63, 0, 0},
{0, 1, 63, 0, 0},
{0, 1, 63, 0, 0},
{0, 0, 63, 0, 0},
{0, 0, 63, 0, 0},
{0, 0, 64, 0, 0},
{0, 0, 63, 0, 0},
{0, 0, 63, 0, 0},
{0, 0, 63, 1, 0},
{0, 0, 63, 1, 0},
{0, 0, 63, 2, 0},
{0, 0, 63, 2, 0},
{0, 0, 63, 3, 0},
{0, 0, 63, 3, 0},
{0, 0, 63, 4, 0},
{0, 0, 63, 4, 0},
{0, 0, 63, 5, 0},
{0, 0, 63, 5, 0},
{0, 0, 63, 6, 0},
{0, 0, 63, 6, 0},
{0, 0, 63, 7, 0},
{0, 0, 63, 7, 0},
{0, 0, 63, 8, 0},
{0, 0, 63, 8, 0},
{0, 0, 63, 9, 0},
{0, 0, 63, 9, 0},
{0, 0, 63, 10, 0},
{0, 0, 63, 10, 0},
{0, 0, 63, 10, 0},
{0, 0, 63, 11, 0},
{0, 0, 63, 11, 0},
{0, 0, 63, 12, 0},
{0, 0, 63, 12, 0},
{0, 0, 63, 13, 0},
{0, 0, 63, 13, 0},
{0, 0, 63, 14, 0},
{0, 0, 63, 14, 0},
{0, 0, 63, 15, 0},
{0, 0, 62, 15, 0},
{0, 0, 62, 15, 0},
{0, 0, 62, 16, 0},
{0, 0, 62, 16, 0},
{0, 0, 62, 17, 0},
{0, 0, 62, 17, 0},
{0, 0, 62, 18, 0},
{0, 0, 62, 18, 0},
{0, 0, 62, 18, 0},
{0, 0, 62, 19, 0},
{0, 0, 62, 19, 0},
{0, 0, 62, 20, 0},
{0, 0, 62, 20, 0},
{0, 0, 61, 20, 0},
{0, 0, 61, 21, 0},
{0, 0, 61, 21, 0},
{0, 0, 61, 22, 0},
{0, 0, 61, 22, 0},
{0, 0, 61, 22, 0},
{0, 0, 61, 23, 0},
{0, 0, 61, 23, 0},
{0, 0, 61, 24, 0},
{0, 0, 61, 24, 0},
{0, 0, 60, 24, 0},
{0, 0, 60, 25, 0},
{0, 0, 60, 25, 0},
{0, 0, 60, 26, 0},
{0, 0, 60, 26, 0},
{0, 0, 60, 26, 0},
{0, 0, 60, 27, 0},
{0, 0, 60, 27, 0},
{0, 0, 60, 28, 0},
{0, 0, 59, 28, 0},
{0, 0, 59, 28, 0},
{0, 0, 59, 29, 0},
{0, 0, 59, 29, 0},
{0, 0, 59, 29, 0},
{0, 0, 59, 30, 0},
{0, 0, 59, 30, 0},
{0, 0, 58, 30, 0},
{0, 0, 58, 31, 0},
{0, 0, 58, 31, 0},
{0, 0, 58, 32, 0},
{0, 0, 58, 32, 0},
{0, 0, 58, 32, 0},
{0, 0, 58, 33, 0},
{0, 0, 57, 33, 0},
{0, 0, 57, 33, 0},
{0, 0, 57, 34, 0},
{0, 0, 57, 34, 0},
{0, 0, 57, 34, 0},
{0, 0, 57, 35, 0},
{0, 0, 56, 35, 0},
{0, 0, 56, 35, 0},
{0, 0, 56, 36, 0},
{0, 0, 56, 36, 0},
{0, 0, 56, 36, 0},
{0, 0, 56, 37, 0},
{0, 0, 55, 37, 0},
{0, 0, 55, 37, 0},
{0, 0, 55, 38, 0},
{0, 0, 55, 38, 0},
{0, 0, 55, 38, 0},
{0, 0, 55, 39, 0},
{0, 0, 54, 39, 0},
{0, 0, 54, 39, 0},
{0, 0, 54, 39, 0},
{0, 0, 54, 40, 0},
{0, 0, 54, 40, 0},
{0, 0, 53, 40, 0},
{0, 0, 53, 41, 0},
{0, 0, 53, 41, 0},
{0, 0, 53, 41, 0},
{0, 0, 53, 42, 0},
{0, 0, 52, 42, 0},
{0, 0, 52, 42, 0},
{0, 0, 52, 42, 0},
{0, 0, 52, 43, 0},
{0, 0, 51, 43, 0},
{0, 0, 51, 43, 0},
{0, 0, 51, 44, 0},
{0, 0, 51, 44, 0},
{0, 0, 51, 44, 0},
{0, 0, 50, 44, 0},
{0, 0, 50, 45, 0},
{0, 0, 50, 45, 0},
{0, 0, 50, 45, 0},
{0, 0, 49, 45, 0},
{0, 0, 49, 46, 0},
{0, 0, 49, 46, 0},
{0, 0, 49, 46, 0},
{0, 0, 48, 46, 0},
{0, 0, 48, 47, 0},
{0, 0, 48, 47, 0},
{0, 0, 48, 47, 0},
{0, 0, 48, 48, 0},
{0, 0, 47, 48, 0},
{0, 0, 47, 48, 0},
{0, 0, 47, 48, 0},
{0, 0, 46, 48, 0},
{0, 0, 46, 49, 0},
{0, 0, 46, 49, 0},
{0, 0, 46, 49, 0},
{0, 0, 45, 49, 0},
{0, 0, 45, 50, 0},
{0, 0, 45, 50, 0},
{0, 0, 45, 50, 0},
{0, 0, 44, 50, 0},
{0, 0, 44, 51, 0},
{0, 0, 44, 51, 0},
{0, 0, 44, 51, 0},
{0, 0, 43, 51, 0},
{0, 0, 43, 51, 0},
{0, 0, 43, 52, 0},
{0, 0, 42, 52, 0},
{0, 0, 42, 52, 0},
{0, 0, 42, 52, 0},
{0, 0, 42, 53, 0},
{0, 0, 41, 53, 0},
{0, 0, 41, 53, 0},
{0, 0, 41, 53, 0},
{0, 0, 40, 53, 0},
{0, 0, 40, 54, 0},
{0, 0, 40, 54, 0},
{0, 0, 39, 54, 0},
{0, 0, 39, 54, 0},
{0, 0, 39, 54, 0},
{0, 0, 39, 55, 0},
{0, 0, 38, 55, 0},
{0, 0, 38, 55, 0},
{0, 0, 38, 55, 0},
{0, 0, 37, 55, 0},
{0, 0, 37, 55, 0},
{0, 0, 37, 56, 0},
{0, 0, 36, 56, 0},
{0, 0, 36, 56, 0},
{0, 0, 36, 56, 0},
{0, 0, 35, 56, 0},
{0, 0, 35, 56, 0},
{0, 0, 35, 57, 0},
{0, 0, 34, 57, 0},
{0, 0, 34, 57, 0},
{0, 0, 34, 57, 0},
{0, 0, 33, 57, 0},
{0, 0, 33, 57, 0},
{0, 0, 33, 58, 0},
{0, 0, 32, 58, 0},
{0, 0, 32, 58, 0},
{0, 0, 32, 58, 0},
{0, 0, 31, 58, 0},
{0, 0, 31, 58, 0},
{0, 0, 30, 58, 0},
{0, 0, 30, 59, 0},
{0, 0, 30, 59, 0},
{0, 0, 29, 59, 0},
{0, 0, 29, 59, 0},
{0, 0, 29, 59, 0},
{0, 0, 28, 59, 0},
{0, 0, 28, 59, 0},
{0, 0, 28, 60, 0},
{0, 0, 27, 60, 0},
{0, 0, 27, 60, 0},
{0, 0, 26, 60, 0},
{0, 0, 26, 60, 0},
{0, 0, 26, 60, 0},
{0, 0, 25, 60, 0},
{0, 0, 25, 60, 0},
{0, 0, 24, 60, 0},
{0, 0, 24, 61, 0},
{0, 0, 24, 61, 0},
{0, 0, 23, 61, 0},
{0, 0, 23, 61, 0},
{0, 0, 22, 61, 0},
{0, 0, 22, 61, 0},
{0, 0, 22, 61, 0},
{0, 0, 21, 61, 0},
{0, 0, 21, 61, 0},
{0, 0, 20, 61, 0},
{0, 0, 20, 62, 0},
{0, 0, 20, 62, 0},
{0, 0, 19, 62, 0},
{0, 0, 19, 62, 0},
{0, 0, 18, 62, 0},
{0, 0, 18, 62, 0},
{0, 0, 18, 62, 0},
{0, 0, 17, 62, 0},
{0, 0, 17, 62, 0},
{0, 0, 16, 62, 0},
{0, 0, 16, 62, 0},
{0, 0, 15, 62, 0},
{0, 0, 15, 62, 0},
{0, 0, 15, 63, 0},
{0, 0, 14, 63, 0},
{0, 0, 14, 63, 0},
{0, 0, 13, 63, 0},
{0, 0, 13, 63, 0},
{0, 0, 12, 63, 0},
{0, 0, 12, 63, 0},
{0, 0, 11, 63, 0},
{0, 0, 11, 63, 0},
{0, 0, 10, 63, 0},
{0, 0, 10, 63, 0},
{0, 0, 10, 63, 0},
{0, 0, 9, 63, 0},
{0, 0, 9, 63, 0},
{0, 0, 8, 63, 0},
{0, 0, 8, 63, 0},
{0, 0, 7, 63, 0},
{0, 0, 7, 63, 0},
{0, 0, 6, 63, 0},
{0, 0, 6, 63, 0},
{0, 0, 5, 63, 0},
{0, 0, 5, 63, 0},
{0, 0, 4, 63, 0},
{0, 0, 4, 63, 0},
{0, 0, 3, 63, 0},
{0, 0, 3, 63, 0},
{0, 0, 2, 63, 0},
{0, 0, 2, 63, 0},
{0, 0, 1, 63, 0},
{0, 0, 1, 63, 0},
{0, 0, 0, 63, 0},
{0, 0, 0, 63, 0},
{0, 0, 0, 64, 0},
{0, 0, 0, 63, 0},
{0, 0, 0, 63, 0},
{0, 0, 0, 63, 1},
{0, 0, 0, 63, 1},
{0, 0, 0, 63, 2},
{0, 0, 0, 63, 2},
{0, 0, 0, 63, 3},
{0, 0, 0, 63, 3},
{0, 0, 0, 63, 4},
{0, 0, 0, 63, 4},
{0, 0, 0, 63, 5},
{0, 0, 0, 63, 5},
{0, 0, 0, 63, 6},
{0, 0, 0, 63, 6},
{0, 0, 0, 63, 7},
{0, 0, 0, 63, 7},
{0, 0, 0, 63, 8},
{0, 0, 0, 63, 8},
{0, 0, 0, 63, 9},
{0, 0, 0, 63, 9},
{0, 0, 0, 63, 10},
{0, 0, 0, 63, 10},
{0, 0, 0, 63, 10},
{0, 0, 0, 63, 11},
{0, 0, 0, 63, 11},
{0, 0, 0, 63, 12},
{0, 0, 0, 63, 12},
{0, 0, 0, 63, 13},
{0, 0, 0, 63, 13},
{0, 0, 0, 63, 14},
{0, 0, 0, 63, 14},
{0, 0, 0, 63, 15},
{0, 0, 0, 62, 15},
{0, 0, 0, 62, 15},
{0, 0, 0, 62, 16},
{0, 0, 0, 62, 16},
{0, 0, 0, 62, 17},
{0, 0, 0, 62, 17},
{0, 0, 0, 62, 18},
{0, 0, 0, 62, 18},
{0, 0, 0, 62, 18},
{0, 0, 0, 62, 19},
{0, 0, 0, 62, 19},
{0, 0, 0, 62, 20},
{0, 0, 0, 62, 20},
{0, 0, 0, 61, 20},
{0, 0, 0, 61, 21},
{0, 0, 0, 61, 21},
{0, 0, 0, 61, 22},
{0, 0, 0, 61, 22},
{0, 0, 0, 61, 22},
{0, 0, 0, 61, 23},
{0, 0, 0, 61, 23},
{0, 0, 0, 61, 24},
{0, 0, 0, 61, 24},
{0, 0, 0, 60, 24},
{0, 0, 0, 60, 25},
{0, 0, 0, 60, 25},
{0, 0, 0, 60, 26},
{0, 0, 0, 60, 26},
{0, 0, 0, 60, 26},
{0, 0, 0, 60, 27},
{0, 0, 0, 60, 27},
{0, 0, 0, 60, 28},
{0, 0, 0, 59, 28},
{0, 0, 0, 59, 28},
{0, 0, 0, 59, 29},
{0, 0, 0, 59, 29},
{0, 0, 0, 59, 29},
{0, 0, 0, 59, 30},
{0, 0, 0, 59, 30},
{0, 0, 0, 58, 30},
{0, 0, 0, 58, 31},
{0, 0, 0, 58, 31},
{0, 0, 0, 58, 32},
{0, 0, 0, 58, 32},
{0, 0, 0, 58, 32},
{0, 0, 0, 58, 33},
{0, 0, 0, 57, 33},
{0, 0, 0, 57, 33},
{0, 0, 0, 57, 34},
{0, 0, 0, 57, 34},
{0, 0, 0, 57, 34},
{0, 0, 0, 57, 35},
{0, 0, 0, 56, 35},
{0, 0, 0, 56, 35},
{0, 0, 0, 56, 36},
{0, 0, 0, 56, 36},
{0, 0, 0, 56, 36},
{0, 0, 0, 56, 37},
{0, 0, 0, 55, 37},
{0, 0, 0, 55, 37},
{0, 0, 0, 55, 38},
{0, 0, 0, 55, 38},
{0, 0, 0, 55, 38},
{0, 0, 0, 55, 39},
{0, 0, 0, 54, 39},
{0, 0, 0, 54, 39},
{0, 0, 0, 54, 39},
{0, 0, 0, 54, 40},
{0, 0, 0, 54, 40},
{0, 0, 0, 53, 40},
{0, 0, 0, 53, 41},
{0, 0, 0, 53, 41},
{0, 0, 0, 53, 41},
{0, 0, 0, 53, 42},
{0, 0, 0, 52, 42},
{0, 0, 0, 52, 42},
{0, 0, 0, 52, 42},
{0, 0, 0, 52, 43},
{0, 0, 0, 51, 43},
{0, 0, 0, 51, 43},
{0, 0, 0, 51, 44},
{0, 0, 0, 51, 44},
{0, 0, 0, 51, 44},
{0, 0, 0, 50, 44},
{0, 0, 0, 50, 45},
{0, 0, 0, 50, 45},
{0, 0, 0, 50, 45},
{0, 0, 0, 49, 45},
{0, 0, 0, 49, 46},
{0, 0, 0, 49, 46},
{0, 0, 0, 49, 46},
{0, 0, 0, 48, 46},
{0, 0, 0, 48, 47},
{0, 0, 0, 48, 47},
{0, 0, 0, 48, 47},
{0, 0, 0, 48, 48},
{0, 0, 0, 47, 48},
{0, 0, 0, 47, 48},
{0, 0, 0, 47, 48},
{0, 0, 0, 46, 48},
{0, 0, 0, 46, 49},
{0, 0, 0, 46, 49},
{0, 0, 0, 46, 49},
{0, 0, 0, 45, 49},
{0, 0, 0, 45, 50},
{0, 0, 0, 45, 50},
{0, 0, 0, 45, 50},
{0, 0, 0, 44, 50},
{0, 0, 0, 44, 51},
{0, 0, 0, 44, 51},
{0, 0, 0, 44, 51},
{0, 0, 0, 43, 51},
{0, 0, 0, 43, 51},
{0, 0, 0, 43, 52},
{0, 0, 0, 42, 52},
{0, 0, 0, 42, 52},
{0, 0, 0, 42, 52},
{0, 0, 0, 42, 53},
{0, 0, 0, 41, 53},
{0, 0, 0, 41, 53},
{0, 0, 0, 41, 53},
{0, 0, 0, 40, 53},
{0, 0, 0, 40, 54},
{0, 0, 0, 40, 54},
{0, 0, 0, 39, 54},
{0, 0, 0, 39, 54},
{0, 0, 0, 39, 54},
{0, 0, 0, 39, 55},
{0, 0, 0, 38, 55},
{0, 0, 0, 38, 55},
{0, 0, 0, 38, 55},
{0, 0, 0, 37, 55},
{0, 0, 0, 37, 55},
{0, 0, 0, 37, 56},
{0, 0, 0, 36, 56},
{0, 0, 0, 36, 56},
{0, 0, 0, 36, 56},
{0, 0, 0, 35, 56},
{0, 0, 0, 35, 56},
{0, 0, 0, 35, 57},
{0, 0, 0, 34, 57},
{0, 0, 0, 34, 57},
{0, 0, 0, 34, 57},
{0, 0, 0, 33, 57},
{0, 0, 0, 33, 57},
{0, 0, 0, 33, 58},
{0, 0, 0, 32, 58},
{0, 0, 0, 32, 58},
{0, 0, 0, 32, 58},
{0, 0, 0, 31, 58},
{0, 0, 0, 31, 58},
{0, 0, 0, 30, 58},
{0, 0, 0, 30, 59},
{0, 0, 0, 30, 59},
{0, 0, 0, 29, 59},
{0, 0, 0, 29, 59},
{0, 0, 0, 29, 59},
{0, 0, 0, 28, 59},
{0, 0, 0, 28, 59},
{0, 0, 0, 28, 60},
{0, 0, 0, 27, 60},
{0, 0, 0, 27, 60},
{0, 0, 0, 26, 60},
{0, 0, 0, 26, 60},
{0, 0, 0, 26, 60},
{0, 0, 0, 25, 60},
{0, 0, 0, 25, 60},
{0, 0, 0, 24, 60},
{0, 0, 0, 24, 61},
{0, 0, 0, 24, 61},
{0, 0, 0, 23, 61},
{0, 0, 0, 23, 61},
{0, 0, 0, 22, 61},
{0, 0, 0, 22, 61},
{0, 0, 0, 22, 61},
{0, 0, 0, 21, 61},
{0, 0, 0, 21, 61},
{0, 0, 0, 20, 61},
{0, 0, 0, 20, 62},
{0, 0, 0, 20, 62},
{0, 0, 0, 19, 62},
{0, 0, 0, 19, 62},
{0, 0, 0, 18, 62},
{0, 0, 0, 18, 62},
{0, 0, 0, 18, 62},
{0, 0, 0, 17, 62},
{0, 0, 0, 17, 62},
{0, 0, 0, 16, 62},
{0, 0, 0, 16, 62},
{0, 0, 0, 15, 62},
{0, 0, 0, 15, 62},
{0, 0, 0, 15, 63},
{0, 0, 0, 14, 63},
{0, 0, 0, 14, 63},
{0, 0, 0, 13, 63},
{0, 0, 0, 13, 63},
{0, 0, 0, 12, 63},
{0, 0, 0, 12, 63},
{0, 0, 0, 11, 63},
{0, 0, 0, 11, 63},
{0, 0, 0, 10, 63},
{0, 0, 0, 10, 63},
{0, 0, 0, 10, 63},
{0, 0, 0, 9, 63},
{0, 0, 0, 9, 63},
{0, 0, 0, 8, 63},
{0, 0, 0, 8, 63},
{0, 0, 0, 7, 63},
{0, 0, 0, 7, 63},
{0, 0, 0, 6, 63},
{0, 0, 0, 6, 63},
{0, 0, 0, 5, 63},
{0, 0, 0, 5, 63},
{0, 0, 0, 4, 63},
{0, 0, 0, 4, 63},
{0, 0, 0, 3, 63},
{0, 0, 0, 3, 63},
{0, 0, 0, 2, 63},
{0, 0, 0, 2, 63},
{0, 0, 0, 1, 63},
{0, 0, 0, 1, 63},
{0, 0, 0, 0, 63}
};

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
void setup() {

//Serial.begin(9600);

//POD 2 serial port
Serial3.begin(9600, SERIAL_8N1);

//SETUP THE DS1882 POTENTIONMETERS
Wire.begin(); // join i2c bus (address optional for master)
Wire.beginTransmission(40); //Setup the
Wire.write(B10000110); //B10000110
Wire.endTransmission();
delay(500);

Wire.beginTransmission(41); //Setup the
Wire.write(B10000110); //B10000110
Wire.endTransmission();
delay(500);

Wire.beginTransmission(42); //Setup the
Wire.write(B10000110); //B10000110
Wire.endTransmission();
delay(500);

ChangePot(0, 0, 1);
ChangePot(0, 1, 1);
ChangePot(1, 0, 1);
ChangePot(1, 1, 1);
ChangePot(2, 0, 1);
ChangePot(2, 1, 1);

//Position initialization
FDR_POT_POSITION_CHANGE = FDR_POT_POSITION_STATE;

pinMode(FDR_POT_POSITION_PIN, INPUT);
pinMode(FDR_POT_SLIDE_PIN, INPUT);
pinMode(FNT_POT_EARTH_PIN, INPUT);
pinMode(FNT_POT_GRASS_PIN, INPUT);
pinMode(FNT_POT_SKY_PIN, INPUT);
pinMode(FNT_POT_SUN_PIN, INPUT);

//FADER LED
pinMode(FDR_LED_KEY_CHON_PIN, OUTPUT);
pinMode(FDR_LED_KEY_ONLY_PIN, OUTPUT);
pinMode(FDR_LED_KEY_SEL_PIN, OUTPUT);

//FADER KEY
pinMode(FDR_KEY_CHON_PIN, INPUT);
pinMode(FDR_KEY_ONLY_PIN, INPUT);
pinMode(FDR_KEY_SEL_PIN, INPUT);

//FRONT LED

pinMode(FNT_LED_KEY_EARTH_PIN, OUTPUT);
pinMode(FNT_LED_KEY_GRASS_PIN, OUTPUT);
pinMode(FNT_LED_KEY_SEL_PIN, OUTPUT);
pinMode(FNT_LED_KEY_SKY_PIN, OUTPUT);
pinMode(FNT_LED_KEY_SUN_PIN, OUTPUT);

//FRONT KEY
pinMode(FNT_KEY_EARTH_PIN, INPUT);
pinMode(FNT_KEY_GRASS_PIN, INPUT);
pinMode(FNT_KEY_SEL_PIN, INPUT);
pinMode(FNT_KEY_SKY_PIN, INPUT);
pinMode(FNT_KEY_SUN_PIN, INPUT);

//FRONT NEOPIXELS
FNT_NEO_PIXEL.begin();
FNT_NEO_PIXEL.show(); // Initialize all pixels to ‘off’
}

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
//MAIN LOOP

void loop() {

CheckAnalog(); // Check the Analog value of the pots and the slider

PotScale(); // Scale the pot values into range of 1-64

//If the position or slide changes
if (!(FDR_POT_POSITION_CHANGE == FDR_POT_POSITION_SCALE) | !(FDR_POT_SLIDE_CHANGE == FDR_POT_SLIDE_SCALE)) {

// FDR_POT_SLIDE_STATE is converted into a percentage, multiplied by the lookup value of the fivepoint array
// fivepoint[FDR_POT_POSITION_STATE looks up the value stored in the array][ is the colum number 0 = Ls 4 = Rs]
ChangePot(0, 0, ((int)((float)FDR_POT_SLIDE_STATE / 1024 * fivepoint[FDR_POT_POSITION_STATE][0])));
ChangePot(0, 1, ((int)((float)FDR_POT_SLIDE_STATE / 1024 * fivepoint[FDR_POT_POSITION_STATE][1])));
ChangePot(1, 0, ((int)((float)FDR_POT_SLIDE_STATE / 1024 * fivepoint[FDR_POT_POSITION_STATE][2])));
ChangePot(1, 1, ((int)((float)FDR_POT_SLIDE_STATE / 1024 * fivepoint[FDR_POT_POSITION_STATE][3])));
ChangePot(2, 0, ((int)((float)FDR_POT_SLIDE_STATE / 1024 * fivepoint[FDR_POT_POSITION_STATE – 1][4])));

FDR_POT_POSITION_CHANGE = FDR_POT_POSITION_SCALE;
FDR_POT_SLIDE_CHANGE = FDR_POT_SLIDE_SCALE;
}

CheckKeys(); // Check if any keys have been pressed
LEDupdate(); // Update the LEDs on the keys
UpdateNeopixel(); // Update the colors of the neopixels

//KEY DBOUNCE – SUN
readingSUN = digitalRead(FNT_KEY_SUN_PIN);
if (readingSUN != FNT_KEY_SUN_LAST_STATE) {
lastDebounceTime = millis();
}
if ((millis() – lastDebounceTime) > debounceDelay) {
if (readingSUN != FNT_KEY_SUN_STATE) {
FNT_KEY_SUN_STATE = readingSUN;
StateMachinePodSelect = 1;
}
}
FNT_KEY_SUN_LAST_STATE = readingSUN;

//KEY DBOUNCE – SKY
readingSKY = digitalRead(FNT_KEY_SKY_PIN);
if (readingSKY != FNT_KEY_SKY_LAST_STATE) {
lastDebounceTime = millis();
}
if ((millis() – lastDebounceTime) > debounceDelay) {
if (readingSKY != FNT_KEY_SKY_STATE) {
FNT_KEY_SKY_STATE = readingSKY;
StateMachinePodSelect = 2;
}
}
FNT_KEY_SKY_LAST_STATE = readingSKY;

//KEY DBOUNCE – GRASS
readingGRASS = digitalRead(FNT_KEY_GRASS_PIN);
if (readingGRASS != FNT_KEY_GRASS_LAST_STATE) {
lastDebounceTime = millis();
}
if ((millis() – lastDebounceTime) > debounceDelay) {
if (readingGRASS != FNT_KEY_GRASS_STATE) {
FNT_KEY_GRASS_STATE = readingGRASS;
StateMachinePodSelect = 3;
}
}
FNT_KEY_GRASS_LAST_STATE = readingGRASS;

//KEY DBOUNCE – EARTH
readingEARTH = digitalRead(FNT_KEY_EARTH_PIN);
if (readingEARTH != FNT_KEY_EARTH_LAST_STATE) {
lastDebounceTime = millis();
}
if ((millis() – lastDebounceTime) > debounceDelay) {
if (readingEARTH != FNT_KEY_EARTH_STATE) {
FNT_KEY_EARTH_STATE = readingEARTH;
StateMachinePodSelect = 4;
}
}
FNT_KEY_EARTH_LAST_STATE = readingEARTH;

//STATEMACHINE TO CHANGE POD
switch (StateMachinePodSelect) {
case 1:
digitalWrite(FNT_LED_KEY_SUN_PIN, 0);
digitalWrite(FNT_LED_KEY_SKY_PIN, 1);
digitalWrite(FNT_LED_KEY_GRASS_PIN, 1);
digitalWrite(FNT_LED_KEY_EARTH_PIN, 1);
PodInput(1);
break;
case 2:
digitalWrite(FNT_LED_KEY_SUN_PIN, 1);
digitalWrite(FNT_LED_KEY_SKY_PIN, 0);
digitalWrite(FNT_LED_KEY_GRASS_PIN, 1);
digitalWrite(FNT_LED_KEY_EARTH_PIN, 1);
PodInput(2);
break;

case 3:
digitalWrite(FNT_LED_KEY_SUN_PIN, 1);
digitalWrite(FNT_LED_KEY_SKY_PIN, 1);
digitalWrite(FNT_LED_KEY_GRASS_PIN, 0);
digitalWrite(FNT_LED_KEY_EARTH_PIN, 1);
PodInput(3);
break;

case 4:
digitalWrite(FNT_LED_KEY_SUN_PIN, 1);
digitalWrite(FNT_LED_KEY_SKY_PIN, 1);
digitalWrite(FNT_LED_KEY_GRASS_PIN, 1);
digitalWrite(FNT_LED_KEY_EARTH_PIN, 0);
PodInput(4);
break;

default:
// if nothing else matches, do the default
// default is optional
break;
}

//DISPLAY TO SERIAL FOR TESTING

//DisplayKeyValues();
}

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
// This function Changes the input of the POD2 using Serial 3
void PodInput(byte channel) {

//if you are not currently on this channel
if(StateMachinePodInput != channel){

//Get Ward-Beck Systems POD Attention
Serial3.write(0xF0);

//Write command to Change Channel
Serial3.write(0x80 | channel);
delay(10);
}
}

void CheckKeys()
{

FDR_LED_KEY_CHON_STATE = digitalRead(FDR_KEY_CHON_PIN);

FDR_LED_KEY_ONLY_STATE = digitalRead(FDR_KEY_ONLY_PIN);
FDR_LED_KEY_SEL_STATE = digitalRead(FDR_KEY_SEL_PIN);

FNT_LED_KEY_EARTH_STATE = digitalRead(FNT_KEY_EARTH_PIN);
FNT_LED_KEY_GRASS_STATE = digitalRead(FNT_KEY_GRASS_PIN);
FNT_LED_KEY_SEL_STATE = digitalRead(FNT_KEY_SEL_PIN);
FNT_LED_KEY_SKY_STATE = digitalRead(FNT_KEY_SKY_PIN);

}

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
//This function writes the status of the LED state
void LEDupdate()
{
digitalWrite(FDR_LED_KEY_CHON_PIN, FDR_LED_KEY_CHON_STATE);
digitalWrite(FDR_LED_KEY_ONLY_PIN, FDR_LED_KEY_ONLY_STATE);
digitalWrite(FDR_LED_KEY_SEL_PIN, FDR_LED_KEY_SEL_STATE);

digitalWrite(FNT_LED_KEY_EARTH_PIN, FNT_LED_KEY_EARTH_STATE);
digitalWrite(FNT_LED_KEY_GRASS_PIN, FNT_LED_KEY_GRASS_STATE);
digitalWrite(FNT_LED_KEY_SEL_PIN, FNT_LED_KEY_SEL_STATE);
digitalWrite(FNT_LED_KEY_SKY_PIN, FNT_LED_KEY_SKY_STATE);
digitalWrite(FNT_LED_KEY_SUN_PIN, FNT_LED_KEY_SUN_STATE);
}

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
//This functions gets the analog value and stores it into the STATE variables
void CheckAnalog() {

FDR_POT_POSITION_STATE = analogRead(FDR_POT_POSITION_PIN);
FDR_POT_SLIDE_STATE = analogRead(FDR_POT_SLIDE_PIN);

FNT_POT_EARTH_STATE = analogRead(FNT_POT_EARTH_PIN);
FNT_POT_GRASS_STATE = analogRead(FNT_POT_GRASS_PIN);
FNT_POT_SKY_STATE = analogRead(FNT_POT_SKY_PIN);
FNT_POT_SUN_STATE = analogRead(FNT_POT_SUN_PIN);
}

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
// This function scales the state values as a percentage of the defined PotScaler

void PotScale()
{

FNT_POT_EARTH_SCALE = ((int)((float)FNT_POT_EARTH_STATE / 1024 * PotScaler));
FNT_POT_GRASS_SCALE = ((int)((float)FNT_POT_GRASS_STATE / 1024 * PotScaler));
FNT_POT_SKY_SCALE = ((int)((float)FNT_POT_SKY_STATE / 1024 * PotScaler));
FNT_POT_SUN_SCALE = ((int)((float)FNT_POT_SUN_STATE / 1024 * PotScaler));

FDR_POT_SLIDE_SCALE = ((int)((float)FDR_POT_SLIDE_STATE / 1024 * PotScaler));
FDR_POT_POSITION_SCALE = ((int)((float)FDR_POT_POSITION_STATE / 1024 * PotScaler));
}

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
//This function recieves the Pot number(0-8), the section (0 or 1), and the value of Resistance (0-64)
void ChangePot(byte Pot, int Section, byte PotVal)
{
// Transmit to DS1808, device #40 (0x28) = 0101 000, LSB is auto sent by Arduino Wire
Wire.beginTransmission((40 + Pot));
// choose section 0 or 1
if (Section == 0) {
Wire.write(PotScaler – PotVal); // Write wiper value to the first pot
}
if (Section == 1) { // Section 1 needs a mask
Wire.write(((((PotScaler) – PotVal)) | 0b01000000)); // Write wiper value for second pot
}
Wire.endTransmission();
}

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
void UpdateNeopixel() {
FNT_NEO_PIXEL.setPixelColor(FNT_NEO_PIXEL_SEL, ((float)FDR_POT_SLIDE_STATE / 1024) * 255, 0, 0) ;

FNT_NEO_PIXEL.setPixelColor(FNT_NEO_PIXEL_SUN, ((float)FNT_POT_SUN_STATE / 1024) * 244, ((float)FNT_POT_SUN_STATE / 1024) * 144, ((float)FNT_POT_SUN_STATE / 1024) * 44) ;
FNT_NEO_PIXEL.setPixelColor(FNT_NEO_PIXEL_SKY, 0, 0, ((float)FNT_POT_SKY_STATE / 1024) * 255) ;
FNT_NEO_PIXEL.setPixelColor(FNT_NEO_PIXEL_GRASS, 0, ((float)FNT_POT_GRASS_STATE / 1024) * 255, 0) ;
FNT_NEO_PIXEL.setPixelColor(FNT_NEO_PIXEL_EARTH, ((float)FNT_POT_EARTH_STATE / 1024) * 105, ((float)FNT_POT_EARTH_STATE / 1024) * 69, 0) ;
FNT_NEO_PIXEL.show();
};

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
void DisplayScalers() {
Serial.print(FNT_POT_SUN_SCALE, DEC); Serial.print(“\t”);
Serial.print(FNT_POT_SKY_SCALE, DEC); Serial.print(“\t”);
Serial.print(FNT_POT_GRASS_SCALE, DEC); Serial.print(“\t”);
Serial.print(FNT_POT_EARTH_SCALE, DEC); Serial.print(“\t”);

Serial.print(FDR_POT_SLIDE_SCALE, DEC); Serial.print(“\t”);
Serial.print(FDR_POT_POSITION_SCALE, DEC); Serial.print(“\t”);

Serial.println(“\n”); // prints another carriage return
}

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
void DisplayKeyValues() {
Serial.print(FNT_KEY_EARTH_STATE, DEC);
Serial.print(FNT_KEY_GRASS_STATE, DEC);

Serial.print(FNT_KEY_SEL_STATE, DEC);
Serial.print(FNT_KEY_SKY_STATE, DEC);
Serial.print(FNT_KEY_SUN_STATE, DEC);
}

//▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░▓░
void DisplayPotValues() {
Serial.print(FDR_POT_POSITION_STATE, DEC); Serial.print(“\t”);
Serial.print(FDR_POT_SLIDE_STATE, DEC); Serial.print(“\t”);

Serial.print(FNT_POT_EARTH_STATE, DEC); Serial.print(“\t”);
Serial.print(FNT_POT_GRASS_STATE, DEC); Serial.print(“\t”);
Serial.print(FNT_POT_SKY_STATE, DEC); Serial.print(“\t”);
Serial.print(FNT_POT_SUN_STATE, DEC); Serial.print(“\t”);
Serial.println(“\n”); // prints another carriage return
}

 

On Compressing the English Language

Someone picked my brain the other day looking for a technique to compress language files.

After walking away to think about it… my method was to re-order the ASCII code to the letters by their frequency and the most common words by their frequency.

Where lowercase e is stored as an ASCII value using 1 byte
ASCII  e = 0x61 = 0b1100001 = 7 bits
vs
APK e = 0x1 = 1 bit

… this method stores an E in 1 bit.  This is similar to the Huffman Code with the addition of whole words being included in the code.

For example:

because” is the 94th most used word in the english language and in this method is stored in 7 bits.

I don’t know if this has been done before… but I would imagine it could compress Language files substantially.

I have thought about a third addition of using the most used 2 or three letter combinations commonly used.

APK ORDER APK LET FREQ WORD FEQ APK BIN APK HEX APK BITS USED
0 space 0 0 1
1 e 12.70% 1 1 1
2 t 9.06% 10 2 2
3 a 8.17% 11 3 2
4 o 7.51% 100 4 3
5 i 6.97% 101 5 3
6 n 6.75% 110 6 3
7 s 6.33% 111 7 3
8 h 6.09% 1000 8 4
9 r 5.99% 1001 9 4
10 d 4.25% 1010 A 4
11 l 4.03% 1011 B 4
12 c 2.78% 1100 C 4
13 u 2.76% 1101 D 4
14 m 2.41% 1110 E 4
15 w 2.36% 1111 F 4
16 f 2.23% 10000 10 5
17 g 2.02% 10001 11 5
18 y 1.97% 10010 12 5
19 p 1.93% 10011 13 5
20 b 1.49% 10100 14 5
21 v 0.98% 10101 15 5
22 k 0.77% 10110 16 5
23 j 0.15% 10111 17 5
24 x 0.15% 11000 18 5
25 q 0.10% 11001 19 5
26 z 0.07% 11010 1A 5
27 the 1 11011 1B 5
28 be 2 11100 1C 5
29 to 3 11101 1D 5
30 of 4 11110 1E 5
31 and 5 11111 1F 5
32 a 6 100000 20 6
33 in 7 100001 21 6
34 that 8 100010 22 6
35 have 9 100011 23 6
36 I 10 100100 24 6
37 it 11 100101 25 6
38 for 12 100110 26 6
39 not 13 100111 27 6
40 on 14 101000 28 6
41 with 15 101001 29 6
42 he 16 101010 2A 6
43 as 17 101011 2B 6
44 you 18 101100 2C 6
45 do 19 101101 2D 6
46 at 20 101110 2E 6
47 this 21 101111 2F 6
48 but 22 110000 30 6
49 his 23 110001 31 6
50 by 24 110010 32 6
51 from 25 110011 33 6
52 they 26 110100 34 6
53 we 27 110101 35 6
54 say 28 110110 36 6
55 her 29 110111 37 6
56 she 30 111000 38 6
57 or 31 111001 39 6
58 an 32 111010 3A 6
59 will 33 111011 3B 6
60 my 34 111100 3C 6
61 one 35 111101 3D 6
62 all 36 111110 3E 6
63 would 37 111111 3F 6
64 there 38 1000000 40 7
65 their 39 1000001 41 7
66 what 40 1000010 42 7
67 so 41 1000011 43 7
68 up 42 1000100 44 7
69 out 43 1000101 45 7
70 if 44 1000110 46 7
71 about 45 1000111 47 7
72 who 46 1001000 48 7
73 get 47 1001001 49 7
74 which 48 1001010 4A 7
75 go 49 1001011 4B 7
76 me 50 1001100 4C 7
77 when 51 1001101 4D 7
78 make 52 1001110 4E 7
79 can 53 1001111 4F 7
80 like 54 1010000 50 7
81 time 55 1010001 51 7
82 no 56 1010010 52 7
83 just 57 1010011 53 7
84 him 58 1010100 54 7
85 know 59 1010101 55 7
86 take 60 1010110 56 7
87 people 61 1010111 57 7
88 into 62 1011000 58 7
89 year 63 1011001 59 7
90 your 64 1011010 5A 7
91 good 65 1011011 5B 7
92 some 66 1011100 5C 7
93 could 67 1011101 5D 7
94 them 68 1011110 5E 7
95 see 69 1011111 5F 7
96 other 70 1100000 60 7
97 than 71 1100001 61 7
98 then 72 1100010 62 7
99 now 73 1100011 63 7
100 look 74 1100100 64 7
101 only 75 1100101 65 7
102 come 76 1100110 66 7
103 its 77 1100111 67 7
104 over 78 1101000 68 7
105 think 79 1101001 69 7
106 also 80 1101010 6A 7
107 back 81 1101011 6B 7
108 after 82 1101100 6C 7
109 use 83 1101101 6D 7
110 two 84 1101110 6E 7
111 how 85 1101111 6F 7
112 our 86 1110000 70 7
113 work 87 1110001 71 7
114 first 88 1110010 72 7
115 well 89 1110011 73 7
116 way 90 1110100 74 7
117 even 91 1110101 75 7
118 new 92 1110110 76 7
119 want 93 1110111 77 7
120 because 94 1111000 78 7
121 any 95 1111001 79 7
122 these 96 1111010 7A 7
123 give 97 1111011 7B 7
124 day 98 1111100 7C 7
125 most 99 1111101 7D 7
126 use 100 1111110 7E 7

SUCCESSIVE APPROXIMATION ADC CALCULATOR

Was working on my Micro controller reading and had a need for a calculator to check my work for Successive Approximation of Analog to Digital signals.

WIKIPEDIA:  A successive approximation ADC is a type of analog-to-digital converter that converts a continuous analog waveform into a discrete digital representation via a binary search through all possible quantization levels before finally converging upon a digital output for each conversion.


Screen Shot 2015-03-02 at 5.09.50 PM

Screen Shot 2015-03-02 at 5.21.55 PM


Screen Shot 2015-03-02 at 5.10.01 PM
Here is a Link to the excel calculator for your enjoyment

RLC calculator for components in series

I’ve been calculating a lot of components in series lately for an ECR255 class. I’ve also had to graph them on impedance diagrams and a power triangle.

In an effort to better understand the math I made a calculator for myself. Here is it for you to use and enjoy. If you see any problems please let me know. It was designed in excel 2011 for mac… there WILL be compatibility issues and I hope they’re minor.

How it works:

You can fill int the info you have in the orange boxes. Once the boxes are filled in the calculator should fill in the rest.

If you need to modify anything else, it’s all dependant on the orange boxes. I suggest a goal seek by modifying and orange cell.

Screen Shot 2014-07-06 at 9.36.44 PM

 

 

 

Screen Shot 2014-07-06 at 9.38.09 PM

Screen Shot 2014-07-06 at 9.48.54 PMScreen Shot 2014-07-06 at 9.49.10 PM

 

Screen Shot 2014-07-06 at 9.49.00 PM

Screen Shot 2014-07-06 at 9.49.16 PM

schadow switch mounting information

In the 70’s and into the 90’s WBS used a Schadow switch in almost every product they built. Different buttons required different offsets so “GOLDEN RULES” of design were made up so each engineer was on the same page. I found two of those pages the other day and was fascinated. These drawings are both done by hand and are admirable.

2014-06-27 18.41.15

2014-06-27 18.40.52

Wednesday night TV

Check out Jörg Wuttke, Understanding Microphones

Jörg Wuttke was born in Berlin in 1942. He studied electronics and telecommunications at Karlsruhe University, specializing in acoustics, and was teaching assistant to professor Günther Kurtze, the inventor of the shotgun microphone. He joined Schoeps GmbH as a research engineer in 1970, became its chief engineer in 1972, and is now its technical director.
Mr. Wuttke has been an active member of the Audio Engineering Society for many years, including publishing in the AES Journal and presenting papers and chairing workshops at conventions. In1993 he was awarded an AES Fellowship. Since 1972, he has been a member of the DIN standards committee on microphones and headphones. He maintains an avid interest in listening to music and recording live concerts.

Book recommendation: Audio Systems Design and Installation

ASDIcover br-500x500
http://posttoronto.com/index.php?route=product/category&path=59

This is a very well respected read as recommended to me by Neil Muncy.  At the time I was working for him (in exchange for books and resources) he would not let this one go.  Because this book was originally a short run it was available in limited quantities and the used market priced this book at 100$ – 300$  

The recently had an AES special where it was $20 off, but I think it’s a little past the promotion.  If you were to mail the publisher, they may honor it.

Mine is coming hot off the presses:

Anthony,

I have received your order for Audio Systems Design and Installation,
and will notify you as soon as the printer delivers the first copies.

I had been hoping that would be by Sept. 30, but the printer is still
adjusting proofs so it will likely take a bit longer.

Thanks!

Alan