Changeset 41c4762 in orbit


Ignore:
Timestamp:
11/22/12 15:55:01 (7 years ago)
Author:
Steve Castellotti <sc@…>
Branches:
master, RawEEG, Raw_EEG_Plot, Servo, Tab_Interface, pyramid
Children:
6aa182f, 1a53973
Parents:
60b4520
Message:
  • Working version
  • Control via Arduino UNO
Location:
android
Files:
1 added
7 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • android/src/info/puzzlebox/orbit/MainActivity.java

    r60b4520 r41c4762  
    2323import android.hardware.usb.UsbManager; 
    2424import android.view.Gravity; 
    25 import android.view.Menu; 
    26 import android.view.MenuItem; 
     25//import android.view.Menu; 
     26//import android.view.MenuItem; 
    2727import android.view.View; 
    2828import android.widget.Button; 
     
    3131import android.widget.TextView; 
    3232import android.widget.Toast; 
    33 import android.support.v4.app.NavUtils; 
     33//import android.support.v4.app.NavUtils; 
    3434import android.text.Layout; 
    3535import android.text.method.ScrollingMovementMethod; 
     
    8080 
    8181        SerialDevice serial; 
    82         //      int serialBaudRate = 9600; 
    83         int serialBaudRate = 133333; 
     82        int serialBaudRate = 9600; 
     83//      int serialBaudRate = 133333; 
    8484 
    8585 
  • android/src/info/puzzlebox/orbit/SerialDevice.java

    r60b4520 r41c4762  
    1818class SerialDevice extends AsyncTask<String, Void, String> { 
    1919 
    20         int device_frame_cycle = 21; // 22ms frame cycle for Blade mCX2 (MLP4DSM RC) 
     20//      int device_frame_cycle = 21; // 22ms frame cycle for Blade mCX2 (MLP4DSM RC) 
     21//      int device_frame_cycle = 500; // 0.5s frame cycle for Arduino 
     22        int device_frame_cycle = 1000; // 1s frame cycle for Arduino 
    2123        boolean keep_running = true; 
    2224        private UsbSerialDriver mSerialDevice; 
    2325        //      TextView tv; 
    2426 
    25         byte[] commandNeutral = {0x00, 0x00, 0x00, (byte) 0xaa, 0x05, (byte) 0xff, 0x09, (byte) 0xff, 0x0d, (byte) 0xff, 0x13, 0x54, 0x14, (byte) 0xaa}; 
    26         byte[] commandHover = {0x00, 0x00, 0x01, 0x7d, 0x05, (byte) 0xc5, 0x09, (byte) 0xde, 0x0e, 0x0b, 0x13, 0x54, 0x14, (byte) 0xaa}; 
    27         byte[] commandMaximumThrust = {0x00, 0x00, 0x03, 0x54, 0x05, (byte) 0xc5, 0x09, (byte) 0xde, 0x0e, 0x0b, 0x13, 0x54, 0x14, (byte) 0xaa}; 
     27//      byte[] commandNeutral = {0x00, 0x00, 0x00, (byte) 0xaa, 0x05, (byte) 0xff, 0x09, (byte) 0xff, 0x0d, (byte) 0xff, 0x13, 0x54, 0x14, (byte) 0xaa}; 
     28//      byte[] commandHover = {0x00, 0x00, 0x01, 0x7d, 0x05, (byte) 0xc5, 0x09, (byte) 0xde, 0x0e, 0x0b, 0x13, 0x54, 0x14, (byte) 0xaa}; 
     29//      byte[] commandMaximumThrust = {0x00, 0x00, 0x03, 0x54, 0x05, (byte) 0xc5, 0x09, (byte) 0xde, 0x0e, 0x0b, 0x13, 0x54, 0x14, (byte) 0xaa}; 
     30         
     31        String commandNeutral = "x000"; 
     32//      String commandHover = "x085"; 
     33        String commandHover = "x085\r"; 
     34        String commandMaximumThrust = "x100"; 
    2835 
    2936        String command = "neutral"; 
     
    3138        protected String doInBackground(String... buffers) { 
    3239                String response = ""; 
    33                 byte[] setting = commandNeutral; 
    34  
     40//              byte[] setting = commandNeutral; 
     41//              String setting = commandNeutral; 
     42                String setting = commandHover; 
     43                 
    3544                while (keep_running) { 
    3645 
     
    4352                        } 
    4453 
    45  
    4654                        if (mSerialDevice != null) { 
    4755 
    4856                                try { 
    49                                         //mSerialDevice.write(setting, 1000); 
    50                                         mSerialDevice.write(setting, device_frame_cycle); 
     57                                        mSerialDevice.write(setting.getBytes(), device_frame_cycle); 
    5158                                } catch (IOException e) { 
    5259                                        // TODO Auto-generated catch block 
Note: See TracChangeset for help on using the changeset viewer.