Mouse Mouse.Spin
bbaker
Posts: 16
I have a project working with a ksyboard and I want to add a mouse. I have mouse.spin but I can't get it to work. Does anyone have a MouseDemo.spin. Or can someone look at this and see what I am doing wrong
To start I just want to do a REPEAT and display on TV out values....
OBJ
· Num·· :······ "Numbers"
· TV··· :······ "TV_Terminal"
· kb··· :······ "keyboard"
· ms··· :······ "mouse"
PUB Video | key, mouse
· NewFilmCount := FilmCount
· Newfocus := Focus
· COGNEW(FilmCountPub, @Stack)
· COGNEW(Systemtrigger, @Stack+ 100)
· COGNEW(ServoControl, @Stack+200)
· COGNEW(AudioClk, @Stack+300)
· Num.Init··································· 'Initialize Numbers··
· TV.Start(12)······························· 'Start TV Terminal···
· kb.start(26, 27)··························· 'start the keyboard
· ms.start(24, 25)··························· 'start the mouse
····
·
· ms.delta_reset
· repeat······················ 'Monitor Keyboard
··· TV.dec(ms.buttons)
··· TV.out(" ")
··· key := kb.getkey
··· TV.Str(Num.ToStr(key Num#DEC))
··· TV.Str(Num.ToStr(ms.abs_y, Num#DEC))
·
To start I just want to do a REPEAT and display on TV out values....
OBJ
· Num·· :······ "Numbers"
· TV··· :······ "TV_Terminal"
· kb··· :······ "keyboard"
· ms··· :······ "mouse"
PUB Video | key, mouse
· NewFilmCount := FilmCount
· Newfocus := Focus
· COGNEW(FilmCountPub, @Stack)
· COGNEW(Systemtrigger, @Stack+ 100)
· COGNEW(ServoControl, @Stack+200)
· COGNEW(AudioClk, @Stack+300)
· Num.Init··································· 'Initialize Numbers··
· TV.Start(12)······························· 'Start TV Terminal···
· kb.start(26, 27)··························· 'start the keyboard
· ms.start(24, 25)··························· 'start the mouse
····
·
· ms.delta_reset
· repeat······················ 'Monitor Keyboard
··· TV.dec(ms.buttons)
··· TV.out(" ")
··· key := kb.getkey
··· TV.Str(Num.ToStr(key Num#DEC))
··· TV.Str(Num.ToStr(ms.abs_y, Num#DEC))
·
Comments
mouse object inside your "repeat" loop. I see keyboard data, but no mouse.
OBC
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?
Getting started with the Protoboard? - Propeller Cookbook
Got an SD card? - PropDOS
A Living Propeller FAQ - The Propeller Wiki
(Got the Knowledge? Got a Moment? Add something today!)
I thought I was with;
TV.dec(ms.buttons)
I thought this would Call the Mouse.spin and return the buttons.
The getkey functions waits until a key is pressed. So your Mouse is only requested one time, when you press a key on the Keyboard.
You can use gotkey to test, if a key is pressed, then the loop will not be stopped:
Andy
waitcnt(clkfreq / 4 + cnt)
to your repeat loop to stabilize the display
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
E3 = Thought
http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
You haven't said anything about what board you are using... so, you will want to check the schematics and make sure that your pin assignments for the mouse are right (which you probably have already done[noparse]:)[/noparse]
From your snippet it looks like you are doing something fairly interesting.... kind of frustrating to get held up on a mouse function, huh? That's what I love about the Prop... it makes the impossible possible and the mundane absolutely captivating[noparse]:)[/noparse]
Rich
You might find this one interesting. It is about mouse.spin from May 2006.
http://forums.parallax.com/forums/default.aspx?f=25&m=126471
It won't resolve your issue. I'm posting it as encouragement for recent prop converts and as a reminder of how much has been accomplished in the last 18 months.
The simplest things are only simple, once you understand them[noparse]:)[/noparse]
Rich
Do you get a value > 0 for Present?
If not, I would say you have a Hardware problem.
Andy
rjo_
I am build this project to replace several timing circuits that are not stable enough. They work well for about 10 minutes and then they drift about .05%. and I also need a 48khz PLL locked to a 24hz pulse. There is one variable, I need to adjust in realtime in 1Milliseconds, at setup time, So, I thought I would use a mouse and then discounted it.
I think the Prop makes the most sense. I am going to use another Prop to control several stepping motors and 1 servo. The steppers are 16 degree and I have them geared 2:1, making my two tables move in about 128th of an inch. the second table has a 1 inch travel and moves at .5MM incerments.
The mouse works, I think it was the getkey was stopping it. The mouse.spin is now part of my two apps.
THANKS
I also ordered two more Props with boards......