[prog] Any Arduino-chix and/or Java coders out there?

Natalie Freed eilatann at gmail.com
Mon Dec 30 19:15:32 UTC 2013


Hi Camilla,

As of (I believe) Arduino Leonardo, an Arduino can act as a mouse or
keyboard without the need for special drivers.
http://arduino.cc/en/Reference/MouseKeyboard. I don't know if you have the
option to use the Leonardo or Due boards for this project, but it might
make your life a lot easier software-wise. The Teensy is also awesome,
Arduino software compatible and a bit cheaper:
http://www.pjrc.com/store/teensy.html, with support for mouse/keyboard
(mentioning it because I haven't personally tried mouse/keyboard with an
Arduino yet, but have with the Teensy and it worked flawlessly). (if you go
the Teensy route, the 2.0 version is probably the most Arduino-like, the
3.0 uses an ARM chip, runs on a lower voltage, and generally is a pretty
different board).

Hope this helps!

Natalie





On Sun, Dec 29, 2013 at 7:48 PM, Akkana Peck <akkana at shallowsky.com> wrote:

> Camilla Montonen writes:
> > Hello everyone,
> > I'm trying to hack the open source Arduino mouse glove (
> > http://mouseglove.sourceforge.net/), but have so far run
> > into problems.
> >
> > I need to write a driver for the mouse glove to communicate with
> > my computer, but unfortunately many of the Java libraries required
> > have very obscure documentations (too much for a newbie :( ).
> >
> > Has anyone written mouse drivers in Java?
>
> I haven't ... and Java seems like a strange language to use for
> that, though I know some Arduino people love it. But I often hit
> the same problem you did: that the Java code doesn't "just work",
> and I usually find that trying to get it to work turns into more
> effort than just writing it myself.
>
> Because personally I'd usually use Python for something like this,
> I googled arduino python mouse linux OR x11 (after trying a few
> other keyword combinations that didn't yield anything useful) and
> found a project that's doing something similar, but with a Wii nunchuck:
> http://news.anarchy46.net/2013/04/arduino-wii-nunchuck-on-linux.html
> The key to moving the mouse seems to be this, done when the program
> initializes:
>     d = Xlib.display.Display(None)
> and then this when it's time to move the mouse:
>         d.warp_pointer(x, y, src_window = root)
> (that's in the move_mouse() routine).
>
> So if you read the serial stream coming over USB from the Arduino,
> you could use Xlib.warp_pointer to move the mouse accordingly.
> Reading the stream from the Arduino is easy: I have an example
> here that just shows everything coming from the Arduino (and
> lets you type things to send to it but you won't be needing that):
> https://github.com/akkana/arduino/blob/master/scripts/ardmonitor
> And if the mouse-glove code isn't as well documented as they say it
> is, you could use ardmonitor (or just plain old screen) to watch
> what's coming over the USB line.
>
> Make sure you check what speed they're using on the serial line,
> since you have to open the serial device at the right speed or
> nothing will work.
>
> I'm not sure if you're a newbie to programming in general, or just
> to Java and Arduino. This all might sound a little daunting to a
> beginner, but actually, I think if you fiddle around with that
> Wii nunchuck code you'll probably be able to understand it and use it.
> And the end result will be so much cooler than spending the same
> amount of time trying to reverse-engineer a bunch of complicated
> undocumented Java libraries ...
>
> Of course, if your favorite language is Perl or Ruby or C, I'm sure
> it's just as easy, just look for similar libraries. I'm pretty sure
> there are examples out there for reading arduino output in perl and
> ruby; I haven't looked for mouse-moving examples.
>
> This sounds like a fun project -- good luck! And let us know how it
> works out.
>
>         ...Akkana
> _______________________________________________
> Programming mailing list
> Programming at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/programming
>



-- 
http://nataliefreed.com


More information about the Programming mailing list