Novel Computer Input Device
Novel Computer Input Device
What I wanted to learn, and why it interested me: I want to learn about alternative physical interfaces and how it allows us to use computers differently. I've always been more into physical interfaces than digital UIUX, as you get that touch-based feedback. Exploring this will also inform my design studies and allow me to prototype my ideas in the future.
Final outcome: [Your text goes here. Should be a short description of where you got to in your final build. A couple of sentences.]
Images of final creative/exploratory output
Pressing the button sends a keyboard input that displays how many times you pressed the button, and unplugging a separate bailout pin stops the code from doing anything for debugging and reupload processes.
Process images from development towards creative/exploratory output
[Process image or video. Your image caption goes here. Remember to add alt text if needed.]
[Process image or video. Your image caption goes here. Remember to add alt text if needed.]
Process and reflection:
[Your text goes here; at least 150 words. Address what your process was, e.g. what did you make/do first; how did it go; what did you make/do next; etc.
The process for this was fairly straightforward, being one of those projects where I just needed to add a library and learn a few key commands. I started by wiring up the Arduino mini; I didn't want to solder just yet, so I plugged the pins straight in and held it to a breadboard. Surprisingly, this worked for the time being, though they had a tendency to fall out after a while. Later on, I found out that the technique was to find some male headers and solder them all in. The code worked first try, and everything went pretty well. I did a little bit of reading to understand how exactly the bailout pin worked when connected to ground. The only issue that arose was the text either not displaying or repeating multiple times on a single press of the button, which I found to be the result of not having debouncing. In the future, I'll probably add a slight delay per press in the software side to fix this. All in all, I could've done a bit more, but I had a final design project that I pulled two almost all-nighters in a row for and did not have too much energy remaining. I'll make sure to do my best on project two.
Technical details
[Electrical schematic. Add a brief caption for clarity; this could be as simple as "Electrical schematic" but you can also use the space to describe anything that would be useful for your reader, e.g. "The 12V power came from a LiPo battery, not drawn."]
/*
Keyboard Message test
For the Arduino Leonardo and Micro.
Sends a text string when a button is pressed.
The circuit:
- pushbutton attached from pin 4 to +5V
- 10 kilohm resistor attached from pin 4 to ground
created 24 Oct 2011
modified 27 Mar 2012
by Tom Igoe
modified 11 Nov 2013
by Scott Fitzgerald
This example code is in the public domain.Y button 1
times.
You pressed the button 3 times.
You pressed the button 4 times.
You pressed the button 5 times.
You pressed the button 6 times.
You pressed the button 7 times.
You pressed the button 8 times.
https://docs.arduino.cc/built-in-examples/usb/KeyboardMessage/
*/
#include <Keyboard.h>
const int buttonPin = 4; // input pin for pushbutton
const int KEYBOARD_BAILOUT_PIN = 3;
int previousButtonState = HIGH; // for checking the state of a pushButton
int counter = 0; // button push counter
void setup() {
// make the pushButton pin an input:
pinMode(buttonPin, INPUT);
pinMode(KEYBOARD_BAILOUT_PIN, INPUT_PULLUP);
// initialize control over the keyboard:
Keyboard.begin();
}
void loop() {
int bailoutState = digitalRead(KEYBOARD_BAILOUT_PIN);
// read the pushbutton:
int buttonState = digitalRead(buttonPin);
// if the button state has changed,
if ((buttonState != previousButtonState)
// and it's currently pressed:
&& (buttonState == HIGH) && bailoutState == LOW) {
// increment the button counter
counter++;
// type out a message
Keyboard.print("You pressed the button ");
Keyboard.print(counter);
Keyboard.println(" times.");
}
// save the current button state for comparison next time:
previousButtonState = buttonState;
}