Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Sending Rapid / Persistant Commands to a PIN on: January 16, 2013, 03:50:19 pm
Hi, I'm new to Arduino development and looking for general guidance and assistance.

I'm building a simple robot, which connects to an Arduino board for instructions, which is controlled by an Android/iOS device over WiFi.

I've opted for OSC over WiFi and I can send and receive messages from the Android device and Arduino board.

There are two types of commands I will be sending to the robot:

1 - Move for x seconds
2 - Speed (based on pressure/strength sent to a pin)

I'm planning on using the following approach:

1 - For Movement
Send a message of the following format
/[ANALOG][DIGITAL]/move/[PIN] [SECONDS]
2 - For Speed
/[ANALOG][DIGITAL]/setspeed/[PIN] [SPEED]
3 - Combined
/[ANALOG][DIGITAL]/directional/[PIN_ARRAY] [SPEED_ARRAY]
4 - For Direction Movement
/[ANALOG][DIGITAL]/directionmove/[PIN_ARRAY] [SECONDS]

where:
ANALOG = use analog signal (which I understand has a range of 0-1023)
DIGITAL = use digital signal (which I understand is either on/off, high/low)
PIN = the pin to signal (sent output to)
SECONDS = after x seconds stop output to the pin
SPEED = a value in the range 0 to 1023
PIN_ARRAY = an array of pins to send output to
SPEED_ARRAY = an array of analog values to use in conjunction with PIN_ARRAY
move = move instruction
setspeed = set the speed instruction
directional = set move/speed instruction
directionmove = move in direction for x seconds instruction

(NOTE: The range 0-1023 above is Analog range, this could also be PVM range 0-255)

I'm hoping this is enough to control the capabilities of the robot.

Areas of confusion:
1 - I'm guessing "input" from pins will always be Analog (although these pins can function as Digital input/output)
2 - Are "Output" pins always "Digital"? For instance pin 13 for the LED, I seem to only be able to set it to HGH/LOW
3 - There are Digital pins which accept PVM Output (is this the same as Analog or do we specify a value between 0 and 255)
4 - Using SoftPWM (http://code.google.com/p/rogue-code/wiki/SoftPWMLibraryDocumentation) I was able to dim the LED (pin 13) on and off
5 - I've not used it yet, but I guess certain pins can act as Servo Outputs, which I guess is a way to send an Analog output signal (and could be used for speed control)

Questions and assistance please:
1 - How do I identify which pins are analog, digital or both
2 - How do I identify which pins are input, output or both
3 - I can use SoftPWM for the LED, however which PINS can I send an Analog signal to and is the following code how I would do this:
    pinMode(analogInputToDigitalPin(pin), OUTPUT);
    digitalWrite(analogInputToDigitalPin(pin), 300); //is there an analogWrite and should the range be 0-1023, 0-255, ...?
4 - I have an Arduino Uno R2 and Arduino ADK R3
5 - As I'm planning on offering a remote control on an iOS/Android device, are there any open source projects similar to touchOSC (http://hexler.net/software/touchosc). touchOSC is awesome, but they don't offer a plugin module for iOS/Android, and I'd like the app to have additional features (e.g. a tutorial on how the robot works and how to build it)

Thanks in advance to anyone who feeds back.

Parms
Pages: [1]