 |
WiiLi.org a new revolution
|
| View previous topic :: View next topic |
| Author |
Message |
the-white_knight3
Joined: 27 Jan 2007 Posts: 31
Digg It |
Posted: Sun Jan 28, 2007 5:46 am Post subject: |
|
|
| well, then your method should work fine. I have not explored GlovePie long enough to know if it handles recursion, cause that would probably work better. But I haven't seen any, so your method should work. |
|
| Back to top |
|
 |
cheng
Joined: 27 Jan 2007 Posts: 33
Digg It |
Posted: Sun Jan 28, 2007 6:01 am Post subject: |
|
|
hmmm, I am having a very weird problem:
If I just use keyboard to control the robot to turn, then everything works fine
but as soon as I turn on GlovePie, the keyboard starts to behave weirdly, I use "A" to turn left and "D" to turn right, just like FPS games. After I turn on GlovePie, both "D" and "A" quit working properly (sometimes the robot turns, sometimes it doesn't).
Then I tried to use my wiimote and here is the code:
| Code: | if wiimote.Left == 1 then
debug = "left";
press(key.A);
else
release(key.A);
endif
if wiimote.Right == 1 then
debug = "right";
press(key.A);
else
release(key.A);
endif |
the wiimote.right works fine, but wiimote.left doesn't work at all. I am 100% sure that there is nothing wrong with the wiimote.left button, because my program for controlling the robot can receive a key typed event, and I can see a bunch of outputs while I pressed down the left button. But it just doesn't work.
I am using wireless to control my robot, could there be any interference between bluetooth and the wireless network?? |
|
| Back to top |
|
 |
the-white_knight3
Joined: 27 Jan 2007 Posts: 31
Digg It |
Posted: Sun Jan 28, 2007 6:07 am Post subject: |
|
|
Your using both, As in that example... but I get your idea
just from a glance I would say the problem is that your program doesn't understand when two keys are being pressed at the same time. And I think that is what is happening here. But I'm going to test it out right now for you. |
|
| Back to top |
|
 |
TylerK

Joined: 18 Dec 2006 Posts: 384 Location: Springfield, IL
Digg It |
Posted: Sun Jan 28, 2007 6:10 am Post subject: |
|
|
| Code: | | A = Wiimote.Left or Wiimote.Right |
|
|
| Back to top |
|
 |
the-white_knight3
Joined: 27 Jan 2007 Posts: 31
Digg It |
Posted: Sun Jan 28, 2007 6:17 am Post subject: |
|
|
This is what you want:
| Code: |
key.A = Wiimote.Left;
key.D = Wiimote.Right;
|
Now I understand what your doing... lol.. easy.. sorry for not understanding before.
And no, the wireless shouldn't interfere too much. The wii uses both remember. |
|
| Back to top |
|
 |
cheng
Joined: 27 Jan 2007 Posts: 33
Digg It |
Posted: Sun Jan 28, 2007 8:23 am Post subject: |
|
|
Thanks a lot guys
I think I should explain it more clearly
The reason why I assigned the same function to both keys is I want to make sure that the "turning left" function is working. Because it didn't work with the left button, so I want to test it out with the right button.
I didn't choose to use A = wiimote.left is because it only triggers the turning function once. The turning function only turns the robot by a very small angle. I need to repeat this function couple times in order to make a large turn.
Ok, the real problem has nothing to do with the turning function or the syntax in the code. I think the problem is, even with the same function assgined to both left and right button, only the right button can make the robot turn, but left button doesn't do anything(I can detect many key pressed event caused by the left button but the robot just does not wanna move). I don't know if that has anything to do with the USB bluetooth adapter that I am using.
I am currently using the MSI starkey 2.0 bluetooth adapter. |
|
| Back to top |
|
 |
TiagoTiago
Joined: 20 Jan 2007 Posts: 711 Location: Brasil
Digg It |
Posted: Sun Jan 28, 2007 5:45 pm Post subject: Re: Newbie question |
|
|
why insetad of
| Code: |
if pressed(wiimote.Pitch < 30 and wiimote.Pitch > -30)
press(key.C)
wait(100ms)
release(key.C)
endif
|
you don't do
| Code: |
if pressed(wiimote.Pitch < 30 and wiimote.Pitch > -30)
KeepDown(C, 100ms)
endif
|
?
 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|