PDA

View Full Version : Teensy 3.0 and Android ADK 2012



mitch
02-12-2013, 06:07 PM
Hi Paul,

Congratulations on Teensy 3.0.

Any thoughts around support for Android ADK 2012?

How about the general topic of MIDI support on Android?

Thanks and regards, Mitch

PaulStoffregen
02-13-2013, 07:44 AM
I do not own any Android devices. Neither does Robin. So I know relatively little about Android.

I'm also not very familiar with the ADK, and particularly the new 2012 version. I've heard some versions require USB host support.

Teensy 3.0 has USB MIDI device support. It's in the Tools > USB Type menu. I have tested it with Windows, Linux and Mac, but no other platforms like Android.

ARCHILA
02-13-2013, 05:10 PM
Hi, I'm new to the forum "and not speak English well."
I just purchased a Teensy 3.0, I am very interested in the topic Android!, You would have to do to get started?

taskman
02-18-2013, 06:04 AM
Very short version to get you started

Read all the comments and buy this
http://dx.com/p/jy-mcu-arduino-bluetooth-wireless-serial-port-module-104299

Read this
http://www.instructables.com/id/Androino-Talk-with-an-Arduino-from-your-Android-d/


Do this on Android


blueToothAdapter = BluetoothAdapter.getDefaultAdapter();
Set<BluetoothDevice> bondedDevices = blueToothAdapter.getBondedDevices();
bondedDevicesStringList = new ArrayList<String>();
for (BluetoothDevice bondedDevice : bondedDevices) {
bondedDevicesStringList.add(bondedDevice.getName() + " #" + bondedDevice.getAddress());
}




public static final String CONTROLLER_UUID = "00001101-0000-1000-8000-00805F9B34FB";

public boolean connect(String deviceAddress) {
BluetoothAdapter blueToothAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothDevice blueToothDevice = blueToothAdapter.getRemoteDevice(deviceAddress);
try {
socket = blueToothDevice.createRfcommSocketToServiceRecord( UUID.fromString(Main.CONTROLLER_UUID));
// socket = blueToothDevice.createInsecureRfcommSocketToServic eRecord(UUID.fromString(Main.CONTROLLER_UUID));

socket.connect();

return true;

} catch (IOException e) {
Log.e(Main.CONTROLLER_TAG, e.getMessage(), e);
return false;
}
}




private BluetoothSocket socket;
private DataOutputStream out;

public Sender(BluetoothSocket socket) throws IOException {
this.socket = socket;
out = new DataOutputStream(socket.getOutputStream());
}

public void sendCommand(String command) {
try {
out.writeChars(command);
out.flush();
Log.i(Main.CONTROLLER_TAG, "Executing command " + command);
} catch (IOException e) {
Log.e(Main.CONTROLLER_TAG, "Error executing command " + command, e);
}
}


On Teensy
Connect RX to Teensy TX and connect TX to Teensy RX for the serial port you want to use


if (Serial3.available() > 0) {
byte originalValue = Serial3.read();
if (originalValue == 0) return;

char valueRead = (char) originalValue;
#ifdef DEBUG_CONTROLLER_FIRMWARE
Serial.print("Original value read ");
Serial.println(originalValue);

Serial.print("Value read ");
Serial.println(valueRead);

#endif