RMIT-Industrial-Design / HCI-Mobile

RMIT Digital Practice Design Studio 2017
GNU General Public License v3.0
0 stars 5 forks source link

Send function - How to get Arduino to control 'send' function on the Phone #4

Open JelzDalman opened 7 years ago

ScottMit commented 7 years ago

I couldn't find a way to do this via HID key codes or control characters. I have a solution for Android that uses mouse movement and clicks - see the example code. Doesn't work in iOS because mouse movements are ignored here. There may be a solution for iOS using Accessibility - Switch Control.

S3547167 commented 7 years ago

I've found a solution for the send function on iOS

void sendChar(char theChar) { Serial.print("Sending: "); Serial.println(theChar); if (theChar == 0x28) { ble.print("AT+BLEKEYBOARDCODE="); ble.println("00-00-28-00-00");

  if ( ble.waitForOK() )
  {
    Serial.println( F("OK!") );
  } else
  {
    Serial.println( F("FAILED!") );
    // Failed, probably pairing is not complete yet
    Serial.println( F("Please make sure Bluefruit is paired and try again") );
  }

  ble.print("AT+BLEKEYBOARDCODE=");
  ble.println("00-00");

} else { ble.print("AT+BleKeyboard="); ble.println(theChar); // wait for feedback if ( ble.waitForOK() ) { Serial.println("OK!"); } else { Serial.println("FAILED!"); } } }

ScottMit commented 7 years ago

Great! Thanks Mark. So now we can send messages from iOS and Android. Android users, make sure you check out Mark's code before going the mouse click path - it is much neater - it didn't work for my HTC M8 with Google Messages but other phones from other manufacturers may work.

Scott.

f618 commented 7 years ago

Sick thank you!