I hope that I post questions on here very frequently and I apologize for it, I just get very confused very fast when I try to form code.
Basically, I'll be incorporating this device....https://www.thalmic.com/myo/ into a miniaturized version of Arduino with a built in Bluetooth module (the RFduino).
I want to use the Bluetooth transmission between the MYO and the RFduino to control 2 servos and 2 lasers using gestures I make with my hand. I am still awaiting access to the API, but I'm assuming I could label the gestures as signals (i.e. signal1, signal2, etc.), then have the RFduino read those signals as the ones in the code to begin the certain commands. (Each signal would begin a different command (signal3 turns the lasers on and signal4 turns the lasers off, etc.)).
Is it possible for the Arduino to use any of those signals at any time instead of in order, and to stop when I want it to?
I guess what I'm trying to ask is, what type of control structure statements would work best for this type of project? Where I can send any of, lets say 4 signals, at anytime. What is also important is that when, for example, I signal 2 servos to turn 140deg., then signal the 2 lasers to turn on... I want the lasers to be turned on while the servos are in their second positions. Not as they are moving, but once they get there.
I hope this isn't too confusing. There is a lot rattling around in my head and I'm just trying to make sense of writing code. I can do simply commands, but when I try to do something a bit more complex, I begin to panic.
I think your head is getting jumbled because you're trying to figure out everything at once. Break it down into the smallest steps you can and build up from there.
Don't solve all the problems at once. Start with simple, well known, input methods and use these to control your hardware. This will let you get started before you get access to the API. For example, hook up a bunch of pushbuttons to the Arduino and use button presses as triggers for the events you want to control. The buttons will obviously signal only on/off but you'll get the idea. Alternatively, you could hook up little thumb-sticks (Thumb Joystick - COM-09032 - SparkFun Electronics) which would give you analog control. In this way you can tame the input side whilst you worry about the output side. Once the outputs are working as you expect, switch the buttons for your fancy hardware. Use the serial terminal to help you debug.
I agree with what you are saying and I'm most likely going to buy the thumb sticks and go from there.
But what I would like to know as well, is what type of statements would fit this type of project best?
I do not know much about the "if" statements, but I feel as though those might do the trick. Is there
anything that would be better than that to suit my needs?
Ok, I see where you're coming from now. You will likely end up using most things on this page: Arduino - Home
This isn't something you're going to learn by reading the references pages alone, though. Before you actually start playing with the fancy hardware you're going to have to work through some simple examples. I suggest these as a starting point: ARDX – Arduino Expermentation Kit « .:oomlout:. Run through examples (you might want to buy some or all of the items from the starter kit) then try extending them in ways that you imagine might be useful for what you're trying to achieve. Perhaps buy the Arduino Cookbook and work through some of the recipes in that.
Again, you want to start as simple as possible. e.g. Use LEDs as a proxy for whatever output device you will finally end up using.
EDIT:
Let me put it another way. You're learning C, and that's just like learning any foreign language. Treat it the same way: build up logically and slowly and don't expect to be reading literature for a little while.
That seems like the right way to go with this. And its great timing because the first batch of MYO doesn't get released till the end of this year, so I have some time
I appreciate the links a lot, as well as the advice!
I already have most of the hardware made along with the servos and lasers. Now, I'm just waiting for the RFduino and MYO to ship. I gotta say, its looking pretty darn cool
I'm going to read up, try some codes, and come back to this thread (most likely for further assistance