Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
MICHAEL GARDI
Published © CC BY-NC

Another Mostly 3D Printed Rotary Switch

I needed a 5x7 LED display for a Think-a-Tron reproduction project. Unable to find one commercially I decided to make my own.

IntermediateFull instructions provided2 hours728
Another Mostly 3D Printed Rotary Switch

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
Used for testing.
×1

Story

Read more

Custom parts and enclosures

Rotary+Switch+Piston.stl

Rotary+Switch+Wiring+Rig.stl

Rotary+Switch+Gasket.stl

Rotary+Switch+Top.stl

Rotary+Switch+Rotor.stl

Rotary+Switch+Base.stl

Code

Sketch to Test the Rotary Switch and 5x7 NeoPixel Display

Arduino
#include "FastLED.h"
#define NUM_LEDS 35
#define LEDS_PIN 6
CRGB leds[NUM_LEDS];
int A[35] = {0,0,1,1,1,1,1,
0,1,0,0,1,0,0,
1,0,0,0,1,0,0,
0,1,0,0,1,0,0,
0,0,1,1,1,1,1};
int B[35] = {1,1,1,1,1,1,1,
1,0,0,1,0,0,1,
1,0,0,1,0,0,1,
1,0,0,1,0,0,1,
0,1,1,0,1,1,0};
int C[35] = {0,1,1,1,1,1,0,
1,0,0,0,0,0,1,
1,0,0,0,0,0,1,
1,0,0,0,0,0,1,
0,1,0,0,0,1,0};
int T[35] = {1,0,0,0,0,0,0,
1,0,0,0,0,0,0,
1,1,1,1,1,1,1,
1,0,0,0,0,0,0,
1,0,0,0,0,0,0};
int F[35] = {1,1,1,1,1,1,1,
1,0,0,1,0,0,0,
1,0,0,1,0,0,0,
1,0,0,1,0,0,0,
1,0,0,0,0,0,0};
int a = 0;
void setup()  {
Serial.begin(115200);
Serial.println("Test Resistor Network");
pinMode(A5, INPUT_PULLUP);
FastLED.addLeds<NEOPIXEL, LEDS_PIN>(leds, NUM_LEDS);
Serial.begin(115200);
Serial.println("5x7 LED Array");
FastLED.setBrightness(32);
}
int countA = 0;
int countB = 0;
int countC = 0;
int countT = 0;
int countF = 0;
void loop() {
a = analogRead(5);
Serial.println(a);
if (a <= 78 && a >= 58) countF++;
if (a <= 125 && a >= 105) countT++;
if (a <= 169 && a >= 149) countC++;
if (a <= 206 && a >= 186) countB++;
if (a <= 243 && a >= 223) countA++;
if (countF > 10) {showLetter(F); countA = 0; countB = 0; countC = 0; countT = 0; countF = 0;}
if (countT > 10) {showLetter(T); countA = 0; countB = 0; countC = 0; countT = 0; countF = 0;}
if (countC > 10) {showLetter(C); countA = 0; countB = 0; countC = 0; countT = 0; countF = 0;}
if (countB > 10) {showLetter(B); countA = 0; countB = 0; countC = 0; countT = 0; countF = 0;}
if (countA > 10) {showLetter(A); countA = 0; countB = 0; countC = 0; countT = 0; countF = 0;}
delay(10);
}
void showLetter(int letter[]) {
for (int i = 0; i < NUM_LEDS; i++) {
if (letter[i] == 1) {
leds[i] = CRGB::White;
} else {
leds[i] = CRGB::Black;
}
}
FastLED.show();
}

Credits

MICHAEL GARDI
10 projects • 6 followers
A retired software developer, who appreciates having the time to make whatever the heck he wants.
Contact

Comments

Please log in or sign up to comment.