ezieragabriel / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

PS2 mouse library doesnt function #1050

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.update library description to clarify usage of downloads
2.correct h and cpp code so it runs
3.clarify correct location of library in ver 1.01-in 
sketches/library,sketch/library or arduino 1.01/libraries or arduino 
1.01/library?? - very confusing!!!

What is the expected output? What do you see instead?
code should run with library. It runs on the download "attach:mouse.txt" OK but 
errors out with undeclared variable in cpp and h, also something wrong with 
curlies.

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using? UNO and decimilanouve, arduino 
0023, 1  and 1.01

Please provide any additional information below.
Have used code prior to inclusion in library, modified to use mouse photosensor 
to read position of printed clear plastic disk (rotary encoder)and output for 
use as marine autopilot. Can not update code to use library function. Library 
function would simplify greatly. This code has a lot of useful applications for 
cheap position sensing, linear and rotational.  

Original issue reported on code.google.com by srb5605@gmail.com on 25 Sep 2012 at 9:18

GoogleCodeExporter commented 9 years ago
Why do you write "errors out with undeclared variable in cpp and h, also 
something wrong with curlies" rather than copy and paste the actual error 
message?

Original comment by paul.sto...@gmail.com on 25 Sep 2012 at 9:49

GoogleCodeExporter commented 9 years ago
The PS2 library is a third-party contribution.  Please contact the author 
(which it seems to be Paul Stoffregen) for support.

Original comment by dmel...@gmail.com on 25 Sep 2012 at 9:52

GoogleCodeExporter commented 9 years ago
I'm definitely not the author!

I do maintain the PS2 Keyboard library (also not the author, but it was 
abandoned when I started maintaing in).  I have nothing to do with the PS2 
Mouse one.... at least not right now.

If you do email me (for technical support regarding someone else's code), know 
that describing an error without actually copying and pasting the exact error 
message is not going to make a good impression.

Original comment by paul.sto...@gmail.com on 26 Sep 2012 at 12:49

GoogleCodeExporter commented 9 years ago
Thanks, Paul.
I couldn't figure out (from the site) who to contact, so I appreciate any 
feedback at all. I'm not familiar at all with the protocals involved in 
handling comments etc., but since this code seemed of value to me, I thought it 
might also be of value for other people's projects.
Don't know how to paste the error code from sketch to here. It is:  
ps2 mouse(14);expected constructor,destructore before {token....
ps2 mouse.cpp in function void mouse_init
ps2 mouse 22 mouse nor declared
ps2 mouse.cpp in function "void loop"
etc

Original comment by srb5605@gmail.com on 26 Sep 2012 at 7:05

GoogleCodeExporter commented 9 years ago
Sorry forgot to say that this occurs when the example sketch PS2 mouse.ino is 
run on arduino 1.01. I think that the earlier code, before the library was 
made, is the same as the download "attach:mouse.txt" on the PS2 wpage. I used 
this earlier code in my sketch started over a year ago and it runs OK but I'm 
now having trouble combining this sketch with code written for my output to 
solenoids. I think I recall that similar problems lead me to use the rather 
cumbersome txt version when I started this project. It makes for about 5 pages 
of code to read the mouse and provide output.Usage of the library function 
would make things a lot cleaner. 

Original comment by srb5605@gmail.com on 26 Sep 2012 at 7:21

GoogleCodeExporter commented 9 years ago
I took a look.  I didn't get the same error you saw.  When I compiled the 
example ps2_mouse, I got the error "
In file included from ps2_mouse.cpp:1:
/Users/billw/Documents/Arduino/libraries/ps2/ps2.h:11:22: error: WProgram.h: No 
such file or directory
"
When I made the "standard fix" for 1.0 and later, of replacing the "include 
"WProgram.h"" with "include "arduino.h", it compiled fine...

Original comment by wes...@gmail.com on 28 Sep 2012 at 5:57

GoogleCodeExporter commented 9 years ago
Thanks Wes
I don't get it. After making this post I retried the library code and ended up 
with even more errors than I indicated above. I have the library file in 
c:/program files/arduino-1.01/libraries/ps2 also pu in //Sketch/libraries/ps2. 
I also changed to include arduino.h in the ps2.h file. I just tried again and 
the error says "...\... \ ps2.cpp:In constructor'ps2::ps2(int,int);"
also " a function definition not allowed before'{' token "
plus 2 more
Running on Win xp
When I look at code in ps2.cpp/h the "::" doesn't look familiar to me but I am 
not experienced in the library coding. 
Any thoughts ? I wonder if my main arduino app file are in the right place - 
other sketches seem to run OK though 

Original comment by srb5605@gmail.com on 28 Sep 2012 at 6:58

GoogleCodeExporter commented 9 years ago
David, is it possible to add more text to the "What is the expected output? 
What do you see instead?" question?  Perhaps this should be added:

Please copy any error message by dragging your mouse over the text, press 
CTRL-C (windows, linux) or Command-C (mac) to copy it to the clipboard, and 
then paste the complete error message here.  Please also attach the exact code 
and steps necessary to reproduce this error.

Original comment by paul.sto...@gmail.com on 28 Sep 2012 at 9:56

GoogleCodeExporter commented 9 years ago
David:
I tried this and wow - it works. I went out of date with punch cards and find 
that a lot of stuff is not intuative at all - those up to speed overlook whats 
obvious to them. In this case its the usage of CTRL-C. I had tried repeatedly 
using right mouse click to copy and it simply doesn't work - it pastes only the 
first line of the sketch not the error code. So.. this addition would be 
invaluable to some others at my level and below. Thanks

Back to PS2 mouse library issue... with helpful input above saying it ain't the 
library, I started looking further and it now may be possible that I have have 
a dead mouse encoder that died at at time of combining code into my sketch - 
murphy strikes again if so!!! I'll try dismantling another mouse and see if it 
reads OK.

Original comment by srb5605@gmail.com on 28 Sep 2012 at 6:58

GoogleCodeExporter commented 9 years ago
I carved up a second PS2 mouse and connected it to a second arduino uno so as 
to eliminate hardware potential problems. My results are the same as I had 
before when trying to use the pS2 mouse example that uses the PS2 library. I 
tried arduino 1.01 and also went back to me earlier download running on arduino 
0023. Results are the error codes attached below - yippie I can now cut and 
paste! The sketch stopped and highlighted where shown. I then ran a sketch that 
modifies the text file on the ps2 wpage and it runs fine with results shown in 
attached file. I'm still baffled by this so if anyone has a moment I would 
appreciate any feedback - I must be missing something pretty basic

Original comment by srb5605@gmail.com on 29 Sep 2012 at 6:06

Attachments: