Hey guys,
I've used the RedPark seriable cable with iOS before however, I've only been using it to receive data from an Arduino. My ambition is to be able to transmit information from the iPhone to the Arduino also.
At the moment it's set up to receive
- Arduino RX -> Redpark TX
- Arduino TX -> Redpark RX
- Arduino 5V -> Redpark 5V
- Arduino GND -> Redpark GND
The example I used was to toggle the LED on an Arduino board...
void setup() {
Serial.begin(9600); // Start the serial port
pinMode(13, OUTPUT); // Set the built-in LED to output mode
}
void loop() {
if (Serial.available()) { // If there's anything on the serial port,
byte cmd = Serial.read(); // read a single byte from it.
if (cmd == '1') { // If the command is the character '1',
digitalWrite(13, HIGH); // set the LED on
}
if (cmd == '0') { // If the command is the character '0',
digitalWrite(13, LOW); // set the LED off
Serial.print(cmd, BYTE);
}
}
}
I also used the accompanying iPhone app with the Redpark serial cable. I have confirmed I am able tor receive text (using the default app that comes with the RedPark serial cable. So I know that when the iPhone is connected to the Arduino, I am able to receive transmitted data from the Arduino. I can't however transmit any data (the default app allows you to transmit data + the app confirms that the iPhone has sent data. However I am unable to fall into this method on the Arduino, when sending from the iPhone.
if(Serial.available())
{
...
}
For reference, the iPhone I'm using is the iPhone5 with the 30 pin to lightning adapter.