Go Down

Topic: ps/2 mouse error (Read 7444 times) previous topic - next topic

Ranking

Hello Comunity :)

I'm quite new her so sorry if i make something wrong^^
I wantedt to make a ps/2 mouse out of my Arduino with this Library: ww_w.arduino.cc/playground/ComponentLib/Ps2mouse
(the link is changed because it's my first comment.)

Now startet Arduino 0018 and started the example from the Library.
But when I try to compile it it says:

c:/dokumente und einstellungen/.../arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'

Now I downloaded the Arduino enviroment 0012 because it was used on the site from the library. But when I try to start it with the run.bat it gives me this error masage:

Code: [Select]
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
Exception in thread "main"
java.lang.NumberFormatException: null
       at java.lang.Integer.parseInt(Unknown Source)
       at java.lang.Integer.parseInt(Unknown Source)
       at processing.app.Preferences.getInteger(Preferences.java:750)
       at processing.app.Editor.restorePreferences(Editor.java:420)
       at processing.app.Base.<init>(Base.java:155)
       at processing.app.Base.main(Base.java:104)


now I tried to start the .exe file directly but nothing happens :'(
only the process in the Task manager doesent dissapear and it uses more and more space but without effect for hours  :-/.

Does someone know how to make a ps/2 mouse out of the Arduino with the 0017-0021?? Or can someone say me how to start it. :'(

davekw7x

1.  Copy ps.zip to your sketchbook\libraries directory and unzip it

2.  Start arduino-0018 or -0019 or -0021

3.  From the File->Examples pull-down menu select ps2->ps2_mouse and compile it



Regards,

Dave


Ranking

I put the Library right ther and I put it in the Arduino\libraries folder.
But when I run  it with 0018 or 0021 it returns the same error massage described below :'(.
I can add the library over:
sketch-->import Library-->ps2dev
so I think the Library is in the right place.

Doesen't anyone know how I can start the 0012?
If it helps I'm using  xp.

davekw7x

The steps that I showed result in successful compilation on my Windows XP workstation with arduino-0021.  I would not have posted if I had not tested on my system.

Maybe your download or unzipping resulted in a corrupted library???

What kind of messages do you get in the console window of arduino-0021 when you hold down a "Shift" key when compiling?


Regards,

Dave

Ranking

#4
Nov 13, 2010, 05:06 pm Last Edit: Nov 13, 2010, 05:21 pm by Ranking Reason: 1
when I press shift while compiling in 0021 I get:
Code: [Select]
In file included from C:\Dokumente und Einstellungen\Nutzer\Desktop\Programmieren\Java\arduino-0021\hardware\arduino\cores\arduino/WProgram.h:6,
                from C:\DOKUME~1\Nutzer\LOKALE~1\Temp\build9053873873924970999.tmp\ps2_mouse.cpp:4:
c:/dokumente und einstellungen/nutzer/desktop/programmieren/java/arduino-0021/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected unqualified-id before 'double'
c:/dokumente und einstellungen/nutzer/desktop/programmieren/java/arduino-0021/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected `)' before 'double'
c:/dokumente und einstellungen/nutzer/desktop/programmieren/java/arduino-0021/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected `)' before 'double'


This is the red part of the log only because the hole one is to long.

Perhaps you can send me your MD5 Cheksum of your .zip folder.
My one is: 66830F19F83B628E5214ED0BDE8B1893

Not that we understand wrong I want to emulate a mice with the Arduino and not connect a mice to the Arduino. And for that I use the Library of the bottom from the page below.

davekw7x

#5
Nov 13, 2010, 05:15 pm Last Edit: Nov 13, 2010, 05:37 pm by davekw7x Reason: 1
Here is the md5sum of ps2.zip that I downloaded from http://www.arduino.cc/playground/ComponentLib/Ps2mouse:


H:\ftp\arduino>md5sum ps2.zip
2b31615d8a0d5aa5d6afdaf6cff1bc9e *ps2.zip




Here are the lines that compile ps2.cpp and ps2_mouse.cpp  and perform the link on my system:


H:\ftp\arduino\arduino-0021\hardware\tools\avr\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=21 -IH:\ftp\arduino\arduino-0021\hardware\arduino\cores\arduino -IF:\home\dave\Arduino\libraries\ps2 -IF:\home\dave\Arduino\libraries\ps2\utility F:\home\dave\Arduino\libraries\ps2\ps2.cpp -oC:\DOCUME~1\Dave\LOCALS~1\Temp\build1925890357488789136.tmp\ps2\ps2.cpp.o

H:\ftp\arduino\arduino-0021\hardware\tools\avr\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=21 -IH:\ftp\arduino\arduino-0021\hardware\arduino\cores\arduino -IF:\home\dave\Arduino\libraries\ps2 C:\DOCUME~1\Dave\LOCALS~1\Temp\build1925890357488789136.tmp\ps2_mouse.cpp -oC:\DOCUME~1\Dave\LOCALS~1\Temp\build1925890357488789136.tmp\ps2_mouse.cpp.o

H:\ftp\arduino\arduino-0021\hardware\tools\avr\bin\avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o C:\DOCUME~1\Dave\LOCALS~1\Temp\build1925890357488789136.tmp\ps2_mouse.cpp.elf C:\DOCUME~1\Dave\LOCALS~1\Temp\build1925890357488789136.tmp\ps2\ps2.cpp.o C:\DOCUME~1\Dave\LOCALS~1\Temp\build1925890357488789136.tmp\ps2_mouse.cpp.o C:\DOCUME~1\Dave\LOCALS~1\Temp\build1925890357488789136.tmp\core.a -LC:\DOCUME~1\Dave\LOCALS~1\Temp\build1925890357488789136.tmp -lm




(I added a blank line between commands to make it a little more readable.)



Regards,

Dave

Footnotes:
[1]   I am assuming that you can compile and execute other example sketches with arduino-0021

[2]  I haven't actually tried to see whether the ps2 mouse stuff actually works; I just wanted verify that it can be compiled with arduino-0021 on my Windows XP workstation.

Ranking

#6
Nov 13, 2010, 05:45 pm Last Edit: Nov 13, 2010, 05:46 pm by Ranking Reason: 1
But the example you compiled is to connect a mice or a keyboard to a Arduino
but I want to emulate a mice on my Arduino ;)

I can compile the example from the Library for connecting a mice to the Arduino

davekw7x

#7
Nov 13, 2010, 05:47 pm Last Edit: Nov 13, 2010, 05:53 pm by davekw7x Reason: 1
After a little head-scratching and trying to figure out where I had seen errors like you see, here's what I remembered:

If a library program includes other core library headers before it includes WProgram.h you can get that error.

For example, here's what the beginning of ps2.h looks like:
Code: [Select]

/*
* ps2.h - a library to interface with ps2 devices. See comments in
* ps2.cpp.
* Written by Chris J. Kiick, January 2008.
* Release into public domain.
*/

#ifndef ps2_h
#define ps2_h

#include "WProgram.h"

class PS2
{
.
.
.


This compiles normally.


If you include, say, "WConstants.h" before "WProgram.h" you get error messages like the ones you are seeing.


In file included from H:\ftp\arduino\arduino-0021\hardware\arduino\cores\arduino/WProgram.h:6,
                from F:\home\dave\Arduino\libraries\ps2\/ps2.h:11,
                from F:\home\dave\Arduino\libraries\ps2\ps2.cpp:12:
h:/ftp/arduino/arduino-0021/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected unqualified-id before 'double'
h:/ftp/arduino/arduino-0021/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected `)' before 'double'
h:/ftp/arduino/arduino-0021/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected `)' before 'double'



Maybe that is what older arduino distributions needed or tolerated, but not these days.  All you need is WProgram.h.  It takes care of the other stuff.


So:
1. Use arduino-0021

2. Make sure you have the latest ps2.zip.  Unzipped files have date 01/29/2008.


Regards,

Dave

Ranking

but I dont need the ps2 library
I need the [glow]ps2dev[/glow] library

I will try it^^

davekw7x

#9
Nov 13, 2010, 06:04 pm Last Edit: Nov 13, 2010, 06:09 pm by davekw7x Reason: 1
Quote
I need the ps2dev library

I'm sorry that was working on the wrong library.

Anyhow...


In ps2dev.h, comment out the line that includes WConstants.h.  Put in a lline that includes WProgram.h:

Code: [Select]

/*
* ps2dev.h - a library to interface with ps2 hosts. See comments in
* ps2.cpp.
* Written by Chris J. Kiick, January 2008.
* modified by Gene E. Scogin, August 2008.
* Release into public domain.
*/

#ifndef ps2dev_h
#define ps2dev_h

//#include "WConstants.h"  // The original line---for really old arduino stuff
#include "WProgram.h"      // This is what you should have for arduino-0021

class PS2dev
{
.
.
.


With that change I find that arduino-0021 compiles it without problems.


Regards,

Dave

Ranking

#10
Nov 13, 2010, 06:09 pm Last Edit: Nov 13, 2010, 06:10 pm by Ranking Reason: 1
Thanks for the fast replys!!! ;D ;D ;D

the solution was quite easy if you know how it works^^

you must add this line:
#include "WProgram.h"
at the beginning of the file:
ps2dev.h~
and:
ps2dev.h

letts see if i can make my own mouse now

;D

Ranking

now I can compile and upload it to my Arduino :)

but when I connect the data and the clock wires from a ps/2 cable to the pc and to the arduino on digital pin 3 and 2 the Arduino doesn't starts anymore :'(. And when I reset it my pc says that the connected hardware isn't ok and I don't see the com port of it. When I disconnect the ps/2 wires and reset it it works fine again :-?

Does someone has any idea what I'm doing wrong?

Go Up