This week we show you the different options that are available for the NKK Smart Switches. We have all of the different versions that are available to purchase and show you each and describe a little about each.
We also show you a controller that was built over the weekend to control a script scroller for a live show Mike did the sound engineering for. I used 2 of the NKK lighted switches that we are using in our switcher.
We also go back a few episodes to when we made an Arduino Leonardo emulate a keyboard and a mouse.
Downloads
/*############################## SCRIPT SCROLLER ###############################
This sketch uses 2 lighted NKK pushbuttons to send the keys needed to
up and down arrow through a script for dramas.
From: Mike Myers (http://mikemyers.me) @netnutmike
Let's Make It Episode 39 at http://tech-zen.tv
http://tech-zen.tv
For the sample code, show notes, contact information and many more
videos, visit the show page at http://tech-zen.tv/letsmakeit
Please subscribe to our YouTube channel or our netcasts at any of
your favorite netcast / podcast outlets.
We normally record Let's Make It live on Monday evenings around
9pm eastern. You can watch it live by going to tech-zen.tv and clicking
the live link at the top of the page.
We also have a community setup for our viewers and listeners. You can
join the community by going to community.tech-zen.tv.
We love input on what you would like to know or if you have an idea for
a new Let's Make it episode, you can contact us via email or phone at
the show information page.
################################################################################*/
int Button1 = 2;
int Button2 = 4;
int Button3 = 7;
int But1_g = 3;
int But1_r = 5;
int But2_g = 6;
int But2_r = 9;
int But3_g = 10;
int But3_r = 11;
int nextPin = 0;
int lights[] = {But1_g, But1_r, But2_g, But2_r, But3_g, But3_r};
void setup()
{
pinMode(Button1, INPUT_PULLUP);
pinMode(Button2, INPUT_PULLUP);
pinMode(Button3, INPUT_PULLUP);
for (int l=0; l<6; ++l)
pinMode(lights[l], OUTPUT);
Keyboard.begin();
startupCycle();
}
void loop()
{
if (!digitalRead(Button1)) {
turnAllOn();
Keyboard.press(KEY_UP_ARROW);
} else if (!digitalRead(Button3)) {
turnAllOn();
Keyboard.press(KEY_DOWN_ARROW);
} else {
Keyboard.releaseAll();
turnAllOff();
digitalWrite(But1_r, LOW);
digitalWrite(But3_g, LOW);
}
delay(100);
}
void startupCycle()
{
for (int l=0; l<25; ++l)
{
turnAllOff();
//Serial.println(lights[nextPin]);
digitalWrite(lights[nextPin], LOW);
//digitalWrite(11, LOW);
++nextPin;
if (nextPin > 5)
nextPin = 0;
delay(200);
}
turnAllOn();
}
void turnAllOff()
{
for (int l=0; l<6; ++l)
digitalWrite(lights[l], HIGH);
}
void turnAllOn()
{
for (int l=0; l<6; ++l)
digitalWrite(lights[l], LOW);
}