Re: Remote arm over bluetooth
Bluetooth is a powerful, flexible tool once you get it to work right; it's the 'getting it to work right' that can be fun sometimes
I'm going to link a couple of resources that I've found useful so far in using Bluetooth on the NXT's, they should definitely help get you started.
First, a couple of wiki pages to get you up and running. The first one with the actual Bluetooth setup, the second one is a list of all the Bluetooth functions in RobotC:http://www.robotc.net/wiki/Setting_up_Bluetooth_for_NXThttp://www.robotc.net/wiki/NXT_Functions_Bluetooth
Next, a very awesome tutorial from NXT community member Laurens from his Robot Square blog:http://robotsquare.com/2012/03/21/tutor ... bluetooth/
Finally, a rough breakdown of what you'd be looking at code-wise, possibly (there are usually multiple ways to do things, and I encourage forging your own path; you learn more from it that way, and it makes you a better, wiser engineer):
1) Read value from first, 'master' robotic arm's motor (nMotorEncoder)
2) Save value in a variable (int)
3) Send value to 'slave' robot (SendMessage)
4) Receive message on 'slave' robot (message)
5) Rotate 'slave' robot's motor until it reaches the desired value (nMotorEncoder, in a 'while' loop)
6) Repeat process for other motors. (steps 1-5)
7) Loop entire program (a 'while(true)' loop encompassing the whole thing would work)
-You may want to clear all the encoders at the start of the program, and make sure the arms are physically in the same position. That way they have a shared, zeroed start point.
-Think about how you want the robot to work in plain English, and then
look for code to execute your task.
-nMotorEncoder and nMotorEncoderTarget are going to be your best friends with this program; however, remember how the motors are orientated, and make sure a positive rotation on one isn't causing a negative rotation on the other (it shouldn't but never assume!).
-On that note, check and double check to make sure the motors are plugged into matching ports; if your wrist on the 'master' is in A, the wrist in the 'slave' should be too (to cut down on the confusion).
***5 minutes of planning can save you 5 hours of frustration; trust me, been there done that
I'm pretty excited for this one and look forward to seeing what you come up with. If you get stumped or need any more help, definitely let us know, we're more than happy to help. Keep us posted!
Check out our Blog
! And our Facebook page
Need help? Take a look at our Wiki
and our Forums.I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody