Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Teensy 3.0 and Android ADK 2012

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    7

    Teensy 3.0 and Android ADK 2012

    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

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,086
    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.

  3. #3
    Junior Member ARCHILA's Avatar
    Join Date
    Feb 2013
    Posts
    3
    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?

  4. #4
    Senior Member
    Join Date
    Jan 2013
    Location
    Brisbane Australia
    Posts
    104
    Very short version to get you started

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

    Read this
    http://www.instructables.com/id/Andr...our-Android-d/


    Do this on Android
    Code:
            blueToothAdapter = BluetoothAdapter.getDefaultAdapter();
            Set<BluetoothDevice> bondedDevices = blueToothAdapter.getBondedDevices();
            bondedDevicesStringList = new ArrayList<String>();
            for (BluetoothDevice bondedDevice : bondedDevices) {
                bondedDevicesStringList.add(bondedDevice.getName() + " #" + bondedDevice.getAddress());
            }
    Code:
        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.createInsecureRfcommSocketToServiceRecord(UUID.fromString(Main.CONTROLLER_UUID));
    
                socket.connect();
    
                return true;
    
            } catch (IOException e) {
                Log.e(Main.CONTROLLER_TAG, e.getMessage(), e);
                return false;
            }
        }
    Code:
        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
    Code:
      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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •