LED Tie Bar - Software

The software isn't my best work. I did try to make the effects and color generation abstract, which is why I ended up using a Teensy vs an Trinket Pro or similar. I just needed more processing power.

The software that was loaded when I gave them out as gifts is available at https://github.com/r3dey3/led/tree/tie_bar_v1

One of the neat things I did, was instead of using a ground pin for the inputs (button, and jumper) I simply set on of the pins as an INPUT_PULLUP and the other as an output set to LOW. This isn't an issue for the button, as it's only momentarily pressed, but in order to not waste power through the pullup to ground (I know, it wouldn't be that much) I just check the status of the jumper at startup after setting the state of both pins, waiting, then set both pins to tri-state by setting them to INPUT)

bool ColorsEnabled() {
	//Check if jumper is in place
	pinMode(17, OUTPUT);
	digitalWrite(17, LOW);
	pinMode(19, INPUT_PULLUP);
	delay(5); //give things a slight chance to stabilize 
	bool enableColors = digitalRead(19);
	pinMode(17, INPUT);
	pinMode(19, INPUT);
	return enableColors;

There will be more written here hopefully after the honeymoon. Just ran out of time write stuff.

Show Comments