Introduction: Tweety Button

Welcome to my first Instructable! This is for something I've coined the "Tweety" or, Tweety-Button.

The concept is simple,
you're on your computer and the inspiration to Tweet is welling up inside.
Chrome is being slow today, and you want to get those 140 characters out, fast!
No fear, just click on the Tweety button conveniently placed within arms reach on your desk,
and voila! A magical text interface appears and accepts type until you press 'Enter'
~Insta-Tweet

btw, why yes, that is Tweety Bird rubber popper.




Disclaimer.
As is often done, this is built with an Arduino and the Processing environment.
The code used in the SimpleTweet instructable was integral for getting OAuth working.
So that is beyond the scope of this instructable.


Step 1:

Ingredients

1 Arduino
1 Those things you turn inside out, then then flip into the air.
1 momentary push button
1 resistor, I used 100ohm
some wire, and breadbord
Radioshack sells this 5 pack of circular breadboard which worked perfect

Basically, this circuit goes from +5 to ground at all times, until the button is pressed, then pin 10 goes to high.

As to not reiterate some very simple and helpful code, please visit the SimpleTweet Instructable located here.
https://www.instructables.com/id/Simple-Tweet-Arduino-Processing-Twitter/




Step 2: Worth It Just to Feel the Click~!

This thing is amazingly tactile! I love the way it feels and recommend anyone try this setup.

It's very simple, once your breadboard is the right size, and you've soldered the button to it with the resistor in the right spot, super glue one of those Poppy toys right on top. You'll end up with this...


The code on the Arduino sends a serial '1' when the button is pressed. Processing picks this up and opens up the input screen.

Step 3: When Pressed...

When you click it, the processing app is running invisible, then pops up on your screen, ready to enter text.

Step 4: Typing

Here's the basic code for how I do my typing. I'm hoping that over time this project can be developed based on other peoples input. Now honestly I am having trouble implementing the visible/invisible. Actually, it doesn't work! SO~ I'm hoping by posting this, we can all figure it out together. I'm wishing for this to run in the background and wait for the arduino at all times. Please comment!

import processing.serial.*;

public String tweet;
PFont fnt;
Serial arduino;

void setup() {
  size(800, 100);
  noStroke();
  background(0);
  fnt = loadFont("CourierNew36.vlw");
  textFont(fnt, 32);
  tweet = "";
  println(Serial.list());
  String arduinoPort = Serial.list()[1];
  arduino = new Serial(this, arduinoPort, 9600);
  frame.removeNotify();
}

void keyPressed(){
  if(key == 13){
    background(0);
    sendTweet(tweet);
    text("Tweeted!", 10, 45);
    delay(1000);}
  if (key >= ' ' && key <= 'z'){
    background(0);
    tweet+=key;
    text(tweet, 10, 45);}
  if(key == 8){
    background(0);
    tweet = tweet.substring(0, tweet.length()-1);
    text(tweet, 10, 45);}
  delay(150);
}


void draw(){
  listenForArduino();}

void listenForArduino(){
  int input = 0;
  if(arduino.available() >= 1){
input = arduino.read();
if(input == 1){
frame.addNotify();}
}

Step 5: It's a Tweet!

And here's the final product. Leave comments! I want the optimal setup code wise, and want to hear other success/inspiration.

Adafruit Make It Tweet Challenge

Participated in the
Adafruit Make It Tweet Challenge