cant connect my Arduino with my iPad HELP ME!


I have the Redpark Serial Cable C2-TTL (

and i use the book: iOS Sensor Apps with Arduino, but it doesn´t works!

Here is my Code!

#import "ViewController.h"
#pragma mark - RscMgrDelegate methods

@interface ViewController ()


@implementation ViewController
@synthesize textEntry;
@synthesize serialView;
@synthesize sendButton;

- (void)cableConnected:(NSString *)protocol{
    [rscMgr setBaud:9600];
    [rscMgr open];

- (void)cableDisconnected {

- (void)portStatusChanged{

 - (void)readBytesAvailable:(UInt32)numBytes {
    int bytesRead = [rscMgr read:rxBuffer Length:numBytes];
    NSLog( @"Read %d bytes from serial cable.", bytesRead);
    for(int i = 0;i < numBytes;++i) {
        self.serialView.text = [NSString stringWithFormat:@"%@%c",
        ((char *)rxBuffer)[i]];

- (BOOL) rscMessageRecevide:(UInt8 *)msg TotalLength:(int)len {
    return FALSE;

- (void) didReceivePortConfig {

- (void)viewDidLoad
    [super viewDidLoad];
    rscMgr = [[RscMgr alloc] init];
    [rscMgr setDelegate:self];
	// Do any additional setup after loading the view, typically from a nib.

- (void)didReceiveMemoryWarning
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.

- (IBAction)sendString:(id)sender {
    [self.textEntry resignFirstResponder];
   NSString *text = self.textEntry.text;
    int bytesToWrite = text.length;
    for ( int i = 0; i < bytesToWrite; i++) {
        txBuffer[i] = (int)[text characterAtIndex:i];
    int bytesWritten = [rscMgr write:txBuffer Length:bytesToWrite];

#import <UIKit/UIKit.h>
#import "RscMgr.h"

#define BUFFER_LEN 1024

@interface ViewController : UIViewController <RscMgrDelegate> {
    RscMgr *rscMgr;
    UInt8 rxBuffer[BUFFER_LEN];
    UInt8 txBuffer[BUFFER_LEN];
    UITextView *serialView;
    UITextField *textEntry;
    UIButton *sendButton;
@property (nonatomic, retain) IBOutlet UITextView *serialView;
@property (nonatomic, retain) IBOutlet UIButton *sendButton;
@property (nonatomic, retain) IBOutlet UITextField *textEntry;

- (IBAction)sendString:(id)sender;


// The Arduino Code:

 void setup() {
  pinMode(13, OUTPUT);

void loop() {
  while (Serial.available() <= 0) {
    Serial.println("Hello World");
  Serial.println("Bye World");
  while(1) {
  digitalWrite(13, HIGH);
  digitalWrite(13, LOW);


I dont know what i do wrong and I hope you can help me!


In what way doesn't it work?


okay, sry with the Code I am new here..

when I start the APP on my iPad i dont see that my iPad is connect with my Arduino MEga Board!

In my TextView doesnt stand "Hello World"

and I am sorry about my englsih....

Op3l: okay, sry with the Code I am new here..

Sorry doesn't help us. It's not too late - you can go back and edit your post to add the [ code ] [ /code ] tags so that it displays properly.

so i hope its better now!

The code is much more readable now.

But what is “does not work”? A bit clearer description would help. The 3 things to mention are:
What did you do - We’ve got your code and the hardware, so that bit is good enough.
What did you expect to happen - What did you want that particular program to do -
What actually did happen - like the “message only appeared once” (Reading the code we can only describe what you have coded - which means we do not know what you indeted it to do.)

I want that when I connect the iPad to the Arduino Bord that there is written in my TextView Hello World but it doesnt! And i dont know what my mistake is, because in Xcode and arduino is all right i think!

The Serial.available() function on the Arduino returns the number of bytes available to be read. It can NEVER return a value less than 0. Testing for less than 0 shows cluelessness. You don’t want to do that, do you?

I want only to send a Message (Hello World) from the Arduino to my iPad!

OK, that last sentence makes more sense. I do not understand the other two module/Languages you have in your top post, but I do understand the Arduino.

Your Arduino code will continously output "Hello World" on the Serial line which is the USB which must have been configured at the iPad end. When any single character arrives on the input, it will output one "Bye "World" and blink the LED. Unfortunatly you have not described if "Does not work" implies that we have reached the blinking part or are still i the first part. Try an initial blink (in the setup routine) to verify startup.

I dont know how the iPad USB connection works. On other machines when the USB is "activated" it will cause the Arduino to reset. The boot loader starts first and listens if you are downloading a new program. Depending on various transients there may be a few "junk" characters (until the Serial protocol/USB emulation thereof stabilises) and the Bootloader gives up waiting for a new program. THEN you program will start, and only then will it set the Baudrate. All the previous stuff may confuse your program/iPad USB converter.

I have heard that it is almost impossible to communicate with the iPad because of Apple's proprietary stance on peripherals. Have you tried to go through the Apple developer channels on this? You may find that you need to put up a lot of $$$ to get this simple task completed.


I know that is it possible to connect the iPad with the Arduino.

@ MSquare: I did not connect the iPad to the Arduino with USB. The Output from my iPad goes to the Arduino TX and RX. And the USB goes to my MacBook, because the Arduino Need power. It is possible that the Arduino Board send the Message to m MacBook? And the LED BLINK sometimes when I disconnect my iPad from the Board!

The TX/RX lines of the serial are connected to the USB-Serial converteor on the Arduino board. So if you send on the Arduino it will also appear on the Mac. Lots of room for confusion here. Get a 7, 9 or 12V wallwart adaptor (5 will also work, but is below spec) and use the power input on the Arduino. Possibly (I am not sure) it will help to just plug the USB in a USB charger to supply the Arduino.