Coding Gadgets Projects

Kinect + Arduino

With an Arduino Ethernet, Processing, and a Kinect, I was able to easily create this little demo where hand movement can control a servo. This is just a tiny step in my master plan to create a robot clone so that I don’t have to leave my chair.

The following libraries and drivers made this work and also made it super easy for me to create it:

Daniel Shiffman’s Processing Kinect Library (he knows his stuff and has great examples on his site)
Arduino Ethernet UDP send / receive string

EMAX ES08A Servo

How it works:

  1. The Arduino Ethernet acquires an IP address and waits for UDP packets on a certain port.
  2. The machine with the Kinect sends packets to the Arduino that contain hand coordinate data.
  3. The Arduino then takes this data (an integer) and maps the range from 0 to 180 degrees.
  4. The mapped value is sent to the servo.

jQuery Nivo Slider + WordPress JavaScript error

I don’t know if you can really call this a bug, but it’s certainly something that needs to be dealt with. After implementing the jQuery Nivo Slider plugin (which is great when it works), I was getting the following error in the JavaScript console in Chrome during every image transition:

Uncaught TypeError: Cannot call method 'substr' of undefined

The transitions were working, but the previous image wasn’t ‘overlayed’ by the next image – it would just disappear and the new one would appear. It was almost like something else was there. Looking back at my ‘raw’ HTML code in the WordPress post, I had all three images in sequential order, but neatly aligned by pressing enter after each. What I didn’t know was that WordPress, even in HTML mode, was adding <br /> tags after I pressed enter, causing this problem.

Solution: Make the <img> tags back to back on the same line, thus removing the automatically generated <br /> tags.