Westy92.com If you're bored enough, go ahead and read this. :)

19Nov/110

Emulating a Keystroke using a Staples Easy Button

A friend and client of mine owns a DJ business. He has photo booths that he brings to events as part of a Wedding or DJ package.

The booths are home made. I believe that he uses the program Photobooth on a Mac to take the pictures, and needed an easy way for people to step into the booth and press one button to take a picture. For this reason, I needed to make a Staples® Easy Button™ emulate the spacebar character.

For this to be accomplished, I needed:

  • a Staples® Easy Button™
  • a programmable microcontroller; I used a Teensy because it is cheap ($16) and gets the job done.
  • a USB cable
  • wire
  • a soldering iron
  • a small Phillips Screwdriver
  • a drill and/or knife
  • patience
  • I cannot take credit for most of this project. My primary source was MAKEzine. Before starting this project, I watched that video twice, taking notes the second time.

    The first thing that I did was take apart the Easy Button™ and remove everything that I didn't need. This included the metal bracket, the speaker, and all of the wires. Next I cut two holes. One from the battery compartment to where the speaker was, and also a slot in the battery compartment so the Teensy fits.

    The battery compartment.

    Next I soldered short wires, about 3" in length, from the button to the Teensy. I used ground ("GND") and "B2" as my pins on the Teensy.

    The electronics.

    Next I programmed the Teensy using this source code:

    After programming the Teensy, it is time to test it. Your computer should recognize it as a plug-and-play USB Keyboard, and every time you press the button, it should print a space in a text editor, like you were using your Keyboard's spacebar.

    If it all works fine, place the Teensy into the Easy Button™ like this:

    Teensy in the battery compartment.

    and re-assemble the Easy Button™ until you get this far:

    Easy Button™ mostly assembled.

    Try it again, and if it still works, finish assembling it.

    The finished product looks like this:

    A Staples Easy Button Keystroke Emulator

    and functions like this:

    Congratualtions, you have now built an Easy Button™ that emulates whatever keystroke you want it to!

    Cheers!

    </Westy92>

20Feb/110

Reading From a MySQL Database Using C++

I Googled it. I could not find an easy example of how to set up an environment to do this, so I decided to research a bunch and write my own tutorial!

First things first. You need:

  • Ubuntu (or other linux distribution)
  • A functioning MySQL database to read from
  • Patience!

The first thing you need to do is to install the MySQL++ library on linux.  Open up Terminal and type "sudo apt-get install libmysql++-dev" and press enter.

It should ask for your password, so type that in and watch it install MySQL++.

Now that that is over, create a new folder and navigate to it in Terminal.  Create two blank files, naming one "main.cpp" and "makefile" for the other.

Inside of "main.cpp", paste the following:


Inside of "makefile", paste the following:


Now, you have the basic template saved. You must fill in your MySQL database information for the variables "db", "server", "user", and "pass" in order for this program to work.


Once you have the database info filled in, where it says "select * from database", you may change that to something more appropriate, such as "select first_name, last_name, user_id, email from users".


Now you may simply save it, run "make" and then run the program.


Cheers!

</Westy92>

   

online games juegos gratis games online free games free online games
online game jogos online jeux gratuits giochi gratis oyunlar