Monday, November 12, 2012

Teensyduino Trouble

I was getting an error like this (can't remember it exactly and, of course, didn't think to copy-paste it somewhere. . .).
22 java: not found

I looked for java and couldn't find it on the machine, so I tried sudo apt-cache search java and got entirely too many unhelpful results. . . (I piped it through "more" and the results still weren't terribly helpful).

Then, I found a site where they were downloading Arduino for Raspberry Pi and noticed what looked like the command I used last time I downloaded java plus the "librxtx" is part of the name of a file in the arduino software. I tried this and then the Arduino software already on the machine worked great!

sudo apt-get install openjdk-6-jre
sudo apt-get install librxtx-java

Teensyduino Setup

[edit June 25, 2013 - forgot an important step! The Teensyduino software is not, by default, an executable file! See the new step #14 for more.]

Ladyada.net and Arduino.cc make this *really* easy.

Getting started with the Teensy Board. I'm running Linux and using a Teensy 2.0, so these directions occasionally need minor tweaks for other operating systems or boards.
  1. Get everything ready. Make sure you have all the right hardware and that you know which drivers you need.
  2. I'm using Linux, so I open a terminal and use this command:
  3. uname -a
  4. Check the results of that command for the kernel version (mine is 2.6.32). If your result does not begin with 2.6, you're using an old kernel and may not be able to proceed.
  5. Also check those results to confirm whether you're on a 32 or 64 bit system. My uname -a says "x86_64," so I know I'm using a 64 bit system. My system at home returned "i686", which means I was using a 32 bit system.
  6. Download the appropriate Arduino software for your machine.
  7. Unpack the software. Here's the command I run from my home directory:
  8. tar -xvf ~/Downloads/arduino-1.0.2-linux64.tgz
  9. Sometimes the Linux installers include a program called brltty, which makes the Arduino software not work. Remove this program with the following command (in Linux):
  10. sudo apt-get remove brltty
  11. Now, there will be an arduino folder in your home directory (mine is at:  ~/arduino-1.0.2)
  12. Run the arduino software to make sure it works.
  13. ~/arduino-1.0.2/arduino
  14. Close the arduino software, so you can install some extra files to make it work for the Teensy board.
  15. Download the Teensyduino software that's right for your machine. 
  16. Linux users should also save this to file as "49-teensy.rules" -- my machine tries to be helpful and name it "49-teensy.rules.text", which gives you extra steps later on, so avoid this or rename it after you download it if you have to.
  17. Linux users will likely need to update the udev rules. Use this command (from the directory where the 49-teensy.rules file is:
  18. sudo cp 49-teensy.rules /etc/udev/rules.d/
  19. Make the Teensyduino software executable! You can checkout chmod if you're not familiar with it to make sure this is how you want to do it. Run the chmod command in the folder where you installed the Teensyduino software.
  20. chmod 755 ./teensyduino.64bit
  21. Run the Teensyduino Installer
    1. Choose where your sketchbook (Teensyduino code) should go
    2. Install libraries (I install all of them)
    3. When it's finished, click "Done."
  22. Run your arduino software again (step #9)
  23. Choose your board: Tools --> Board --> Teensy 2.0
  24. I'm using my Teensy board as a USB Keyboard, so I choose that USB Type from the Tools menu as well. 
  25. Tools --> USB Type --> Keyboard + Mouse + Joystick
  26. Confirm that you've got the right keyboard language: Tools --> Keyboard Layout --> US English
It's a good idea to start with a simple program like "Blink" to make sure the code compiles correctly and that the board is being flashed correctly.

The example code can be really useful. The program I needed was simple, so I just chose example code, altered it a little and now the board does exactly what I need it to!

To run example code:
  1. Start up your arduino software as usual (step #9). 
  2. Then, choose File --> Examples --> Teensy --> choose something! I started with USB Keyboard --> Simple
  3. Click the "Verify" button (it looks like a checkmark)
  4. Load it to the board (which, obviously, needs to be plugged in. . .) with the button that looks like an arrow pointing to the right. 
  5. It usually runs the newly-installed program right away, but if it doesn't, you can unplug the Teensy (after it's completed its flash/reboot) and plug it back in to get it to run the program.

I also recommend checking out Arduino's site for more "How-To"s. They've done a great job!


Thursday, February 2, 2012

GoogleCL Docs Upload Fixed for Gdata 2.0.15 and 2.0.16

Months ago, we fixed Google Docs Uploads for GoogleCL folks who use python-gdata 2.0.12 through 2.0.14. Today, we tackled the problem for users of python-gdata 2.0.15 and 2.0.16.

A user sent in a patch that fixed the MIMETYPES error we were getting with 2.0.15 and 2.0.16. It looks like python-gdata moved away from declaring MIMETYPES where we were calling them from, so now we name them explicitly in googlecl/src/googlecl/docs/client.py.

That was a great start, but then we started getting a DocsEntry error and uploads still wouldn't work, so we delved further. Here's the error we got after fixing the MIMETYPES problem.
AttributeError: 'module' object has no attribute 'DocsEntry'

One of our earlier searches brought us to the same error posted on python-gdata's buglist.

Then, we found this blog post, by Demon Lord, where they had success replacing the string "gdata.docs.data.DocsEntry" with the string "gdata.data.GDEntry". We tried that throughout the file googlecl/src/googlecl/docs/client.py and sure enough, that fixed it!

We tested 2.0.0 through 2.0.4 to make sure that didn't break anything for those users and then tested 2.0.12 through 2.0.16 to make sure it worked on all the versions that should be able to upload docs. It does so it's now been committed.

Tuesday, January 31, 2012

Car Troubleshooting

I'm going to use this blog the way I talk about using it: as a place for keeping all my technical stuff. Today, that includes cars.

Car 1 (the favorite) leaks oil like crazy. However, upon closer inspection tonight, I have some evidence to support my hypothesis that it only leaks when it's on (possibly only while she's in park--that was harder to test by myself). I checked the oil today, after it had been off for at least a week, and the oil looked alright. I would normally add oil, but my husband wouldn't. I didn't add any. Then, I turned the car on to check the transmission fluid levels (also has a leak, but a much slower one). Transmission levels appear fine. Turned the car off and decided, just for the hell of it, to check the oil. It was on the "L" bar! Sure enough, there was a big puddle of oil under the car, too. I watched the oil and couldn't see the drips at all. Then, I turned the car on and it dripped once a second! After the car was off, it dripped 9 times the following minute. Hopefully it's the gasket and hopefully it's not a tricky gasket to replace. . . The transmission was easy enough -- drain transmission, take off pan, put on new gasket, put pan back on. Hopefully the oil pan is the same!

MIMETYPES fix gives AttributeError: no 'DocsEntry'

The same gentleman who helped make it possible to fix the docs upload bug also suggested the start of a fix for the MIMETYPES bug we get with python-gdata versions 2.0.15 and 2.0.16 with the fix (with or without this fix, we can't upload docs via python-gdata 2.0.15 or 2.0.16, so the fix was still worth publishing).

The error I get now is:
AttributeError: 'module' object has no attribute 'DocsEntry'

A quick grep of the whole googlecl tree for the term "DocsEntry" shows me that it only exists in gdata versions 2.0.11 and 2.0.14. . . So why does GoogleCL call for it in the trunk/src/googlecl/docs/client.py file? The call for it seems to work with python-gdata 2.0.12 -- I can upload documents of txt and pdf types without a complaint about DocsEntry.

Edit: Resolved this issue and blogged about it here.