• Home
  • About

szehau's weblog

Life, Internet, Software, Gadgets, Programming and Investments

  • life log
  • internet
  • programming
  • software
  • working holiday
  • gadget
  • project

Electronics Project – Simple Card Read Keyboard Emulator Using Arduino Pro Micro

I bought this little thing – Micro Pro – from the China website. I think it is a clone or compatible to the SparkFun’s Micro Pro. It is easy to use. It comes with USB that you can use it to program the microcontroller or let the microcontroller to communicate with your computer. You can simply use the Keyboard library from the Arduino to program a keyboard emulator: http://www.arduino.cc/en/Reference/KeyboardPrintln.

Arduino Pro Micro - Simple Card Read Keyboard Emulator

Below is the specification of the microcontroller:

  • ATmega32U4 running at 5V/16MHz
  • Supported under Arduino IDE v1.0.1
  • On-Board micro-USB connector for programming
  • 4 x 10-bit ADC pins
  • 12 x Digital I/Os (5 are PWM capable)
  • Rx and Tx Hardware Serial Connections

Below is the source code for my program that emulates a card reader keyboard:

int button = 2;

void setup() {
  pinMode(button, INPUT_PULLUP); // Use internal pull up resistor
  Keyboard.begin();
}

void loop() {
  int pressed = digitalRead(button) == 0;
  if (pressed) delay(500);
  if (pressed && digitalRead(button) == 0) {
    Keyboard.println("111111");
    delay(2000);
  } else if (pressed) {
    Keyboard.println("222222");
    delay(2000);
  }
}

If you press the button once quickly, the microcontroller will send the card data string “111111” (with new line) to your PC via USB HID keyboard driver.

If you press the button once a little bit longer (around 500 milliseconds), the microcontroller will send the card data string “222222” (with new line) to your PC via USB HID keyboard driver.

I’m using a internal pull up resistor in the microcontroller itself so that I do not need to have a external resistor to pull up or down the floating digital pin (when used as input). When the input pin is pull down (when the switch is pressed) to the ground, the digitalRead will return zero value and otherwise it will be value one.

It’s so simple that you can make your program ready within minutes. Of course, you must first make sure the programming environment (IDE, the COM port of the Micro Pro is properly installed) is ready.

Electronics Project – Raspberry Pi + Attiny85 + LCD 1620

I always want to start an electronic project that build a home automation system but I don’t have much time. Don’t have time is just a bad excuse. So to make thing starts, I start buying electronic components and devices that I need and trying them one by one.

[Read more…]

What Are Programmers Doing In The Weekend?

What are programmers actually doing most of the time during weekend?

1. Programming related research? programming task that brought back from their office? Personal projects?

2. Or most of them won’t do anything related to programming works at all? instead go somewhere else like shopping? family time? outdoor? and etc?

I think most of them are in category 2. I have some interesting statistic to support this :)

[Read more…]

Monthly Repayment for Housing Loan

Every time when I reading newspaper or websites and come across advertisement about properties (e.g. houses or shops), I always think how much I will need to pay monthly if after I got a loan from bank. And also what if I put more down payments, what would be my monthly repayment? Will it be much different?

[Read more…]

Blogs Updates for February 2009

Below are the updates from my other blogs:

  • Iconfinder.net – New Logo New Features
  • Another free icon search engine – veryicon.com
  • System Architecture Analysis – Google Chrome vs Internet Explore 8
  • WordPress Plugin – Blogtal Trackback
  • PHP: Short URL Algorithm Implementation
  • Java: Randomly sort values in a array (the generic way) in single pass
  • How Do You Know When Your Site Get Indexed in Google Search Engine?
  • Gmail: Inserting Images
  • C#: Unix Time to .Net DateTime and Vice Versa
  • I Hate Spam Blogs
  • How to Add Advertisement Code to WordPress Theme’s Sidebar
  • How to Monetize Your Youtube Video
  • WordPress Plugin – Default Trackbacks
  • How to Request Reconsideration for Inclusion in Google Search Results
  • PHP: session_start() – No such file or directory error
  • PHP: Format integer into number of decimal places
  • HTC Touch Diamond2
  • Show Your iPhone Screen Live on Your Mac Desktop
  • Dell’s Studio One 19
  • Dell Adamo Laptop
  • Nikon D5000 DSLR
  • EagleTec USB Nano Flash Drive
  • Windows 7
  • Internet Explorer 8
  • Merge multiple PDF files in single PDF file
  • TortoiseSVN – Graphical User Interface for Windows to (Sub)version Control
  • A Feature in IE8 Browser That All Other Browser Should Have
  • Windows Vista – List All Files in Current Directory and Sub-Directories
  • How to launch Google Chrome with new browsing session?
  • How to Backup Google Chrome User Data?
  • Windows Vista Keyboard Shortcuts for Microsoft Keyboard
  • Download Youtube videos with single click using RealPlayer 11
  • How to Add Shortcuts to Any Program on Your Desktop Context Menu
  • How to uninstall IE8 in Windows Vista

It seem’s a lot but it is actually not much for one month :)

Next Page »

Email News Letter

Sign up to receive updates daily and to hear what's going on with us

More Posts

5 Essential Things You Need To Have At Your Home During The COVID-19 Pandemic

June 1, 2021 22:15 By Sze Hau

LED Downlight

Troubleshooting A Flickering LED Downlight

February 13, 2016 00:29 By Sze Hau

Repair A Broken iPhone Lightning Cable

January 30, 2016 00:54 By Sze Hau

Blog Network

  • Personal Fincance Personal Finance – Personal Money Tips, Stock Investment, Small Business and Make Money Online
  • Snippet IT Information technology news, ideas and experiences and opinions

Recent

  • 5 Essential Things You Need To Have At Your Home During The COVID-19 Pandemic
  • Troubleshooting A Flickering LED Downlight
  • Repair A Broken iPhone Lightning Cable
  • New Gadget – MacBook Pro with Retina Display (2015)
  • One Watt LED Night Light

Search

Tags

2014 adsense advertisement Arduino baby blog blogtal Canon EOS 400D Chinese New Year Christchurch CNY DiGi DIY electronic FBM Flickr Flickr Uploadr Google Google Maps Google Search Results Google Webmaster Central investment joke KLCI KLSE Lake Tekapo LED MacBook Air Maybank2u Motueka movie mutual funds New Zealand PC Fair 2009 Queenstown restaurant for dinner sharing stock trackback Twitter unit trust visa wordpress wordpress plugin working holiday