Dawn Robotics Forum Support and community forums for Dawn Robotics Ltd 2015-11-17T20:08:47+01:00 http://forum.dawnrobotics.co.uk/feed.php?f=12 2015-11-17T20:08:47+01:00 2015-11-17T20:08:47+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1404&p=2000#p2000 <![CDATA[Project Showcase • Dawn Robotics Closing Down - Support Implications]]>
Some people may already know this based on this blog post, and the fact that we're running a closing down sale, but if not, unfortunately we're closing down, and indeed may already be closed, depending upon when you read this.

For people who have bought our products, please don't worry that you're going to be hung out to dry, support wise. I'll keep monitoring these forums periodically to try to answer any questions people may have. If you post here and don't get a reponse within a couple of days, please email helpdesk@dawnrobotics.co.uk, as notifications from the forum don't always seem to come through. Also please send me an email if parts you've bought recently, break or are faulty in some way, as I've held back some components to deal with this.

Many thanks to all of Dawn Robotics' customers over the last couple of years. It's been fun. :)

Regards

Alan

Statistics: Posted by Alan — Tue Nov 17, 2015 8:08 pm


]]>
2015-08-10T14:05:29+01:00 2015-08-10T14:05:29+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1379&p=1892#p1892 <![CDATA[Project Showcase • usage of home robots]]> I am currently pursuing my masters in Information Security. As a part of my thesis (on vulnerabilities in home robots), i am conducting a small survey on Usage of home robots. I shall be truly grateful, if you could spare 2 mins and complete this survey. Thanks a million for the help
http://freeonlinesurveys.com/s/m3Nijxqt

Statistics: Posted by dhvanik — Mon Aug 10, 2015 2:05 pm


]]>
2015-06-17T19:55:46+01:00 2015-06-17T19:55:46+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1371&p=1850#p1850 <![CDATA[Project Showcase • Re: RB Running Squares]]>
It is running remote on a W8 computer. The script is rather straight forward to keep the coding challenges low (for me). So, I had to take some shortcuts in the solution. In the Google-blog I describe the reasons.

Then one of the two major challenges was of course the timing. I think the sample_time is on the edge of workable. Using py_websocket_bot I couldn’t get it much lower than 0.05 anyhow.

The timer generates weird peaks even when working in plain Python without your classes on several computers. I’m not sure if that’s due to Python. I’ll want to recode the script in C/C++ once, to find out if that’s the case.

The other phenomena was the difference in performance between the left and right motors. I could get one side working with a perfect graph. The other side fell short on the max PWM. Thus resulting in too much weight of the balancing loop in the controlled part. In the blog I mention almost everything I tried, but I’m still guessing for a solution.

Anyhow the outcome is satisfactory as an intermediate result. I’ve just ordered the Grove compass. I’m curious if I can add that while still using py_websockets_bot.

The epic after that will be trying out the improved Dagu mini driver. I’m thinking of building the control loop, including the compass, in Arduino. The memory should be sufficient now, I think.
That will leave me the Raspberry (also probably Model 2) to work on locating and mapping, incorporating vision control. (I might be needing your help in implementing the new Dagu board in py_websockets_bot)
And of course I’ll try more qualitative encoders as well then. (You’ll have them launched at your store by then, I hope). ;-0)

So still a lot of fun ahead and I’ll be back when I’ve something I can share.

Cheers,
Bastian

Statistics: Posted by Bastian — Wed Jun 17, 2015 7:55 pm


]]>
2015-06-17T14:43:06+01:00 2015-06-17T14:43:06+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1371&p=1846#p1846 <![CDATA[Project Showcase • Re: RB Running Squares]]>
That looks really good. I haven't looked at your code in much detail, but I'm really impressed that you got your control loop to run using py_websockets_bot (i.e. not within the web server). Were you running oyur control script on the robot, or on a separate computer?

Regards

Alan

Statistics: Posted by Alan — Wed Jun 17, 2015 2:43 pm


]]>
2015-06-16T22:35:08+01:00 2015-06-16T22:35:08+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1371&p=1844#p1844 <![CDATA[Project Showcase • RB Running Squares]]> I have been digging in on some odometry topics and got the bot running in (rather) straight lines at a certain speed for a certain distance using optical encoders and 3 PID’s.

The video isn’t thrilling, but shows an intermediate result in calibrating the positioning and RB almost finishing a full square with a total perimeter of 12.2 meters.

Video:
https://www.youtube.com/watch?v=8z0CsYaxo8Y

For those who are interested, the following blog contains a more detailed description of the background, approach and a way to use squared runs for further calibration:

https://plus.google.com/113179308235478830494/posts/UiFYacTvDLr

If wanted remarks, suggestions and/or questions can be dropped there as well.


The Python script can be found at:
https://bitbucket.org/RoboBasics/raspberry-robo-cars/src/8df278bd8786da754462197c3b553d1aaa40f599/Scripts/Odm_2_running_squares.py?at=master

I noticed in the forums that several people raised questions on having the robot running straight. The bitbucket repository also contains a Python script for mere proportional correction of the wheel differences. If just straight driving is desired, this script might be helpful.

The approach is a bit raw (left out some things like the acceleration), but it provides a good start for further exploration.

For sure I will work on some improvements in the future (and surely acquire some magnetic encoders for better actuating).

For now I will be working on adding digital compass data to the control loops (or replacing the balancing loop by a compass loop)

Enjoy !

Statistics: Posted by Bastian — Tue Jun 16, 2015 10:35 pm


]]>
2015-06-01T19:13:56+01:00 2015-06-01T19:13:56+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1333&p=1827#p1827 <![CDATA[Project Showcase • Re: Yet Another DIY Bluetooth RC Car]]>
As of it working, I can definitively confirm, it does, on my MotoG 3G 2013 and on my Google/Asus Nexus 7 2012.
With sliders (SeekBars) for throttle and steering, and sending it text commands.

One thing I'd probably LIKE to do is to somehow add a feature to rename the BT receiver from HC-06 to something more, say, freeform. But this means the MD will need to send some AT commands at some specified speed to it probably. Which I hope won't be on their way to fry it.... Ever tried that?

Statistics: Posted by el_es — Mon Jun 01, 2015 7:13 pm


]]>
2015-06-01T19:03:43+01:00 2015-06-01T19:03:43+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1333&p=1826#p1826 <![CDATA[Project Showcase • Re: Yet Another DIY Bluetooth RC Car]]>
Then I'll have to replicate the code for sending strings to the BluetoothChat service, one that is in the BluetoothChat Fragment (https://android.googlesource.com/platfo ... rvice.java and around this is what I presume I've imported...)

(this https://android.googlesource.com/platfo ... hChat.java especially lines 206-221)

which I certainly hope will go well...

I am sorry, really... my Java skill level is approaching 0 exponentially ;J the more I read the less I understand of it ;)

Statistics: Posted by el_es — Mon Jun 01, 2015 7:03 pm


]]>
2015-06-01T12:41:01+01:00 2015-06-01T12:41:01+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1333&p=1825#p1825 <![CDATA[Project Showcase • Re: Yet Another DIY Bluetooth RC Car]]>
Code:
SensorActivity mSensorActivity;            // This goes with the other member variables

mSensorActivity = new SensorActivity();        // This goes wherever your setup code is


Looking at the sample you should just then need to put some printing code in the onSensorChanged code to see readings from the sensor. To get those sensor readings back into your control code you've got a number of options but essentially you need to use a callback that passes back the data.

Apologies if this is way off or completely unhelpful. I'm interested to see how this Android Bluetooth stuff works so will do my best to install the Android tools later this week. Then hopefully I can make some more sensible comments. :)

Regards

Alan

Statistics: Posted by Alan — Mon Jun 01, 2015 12:41 pm


]]>
2015-05-30T21:12:35+01:00 2015-05-30T21:12:35+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1333&p=1822#p1822 <![CDATA[Project Showcase • Re: Yet Another DIY Bluetooth RC Car]]> so, googling for answers how to integrate the motion (axis angle/gyroscope sensor) into my project, i found an interesting page http://developer.android.com/reference/ ... nager.html and a few others but this seems like something ... only have no clue how to integrate this .

I added the snippet as is to a file (bar it did not like that the class was public) and took AS's suggestions so it wouldn't error out. But now since my sendmessage() is in a different class (the Fragment...) i need to do something else, but what?
This http://developer.telerik.com/products/b ... eter-data/ looks simpler... but still no clue how to add that so it would work in an existing fragment/java class...
Yeah I know it's noobish. Please help/point... I am after the left/right turn and front/back turn angles so to use the device as a throttle or steering wheel.

Statistics: Posted by el_es — Sat May 30, 2015 9:12 pm


]]>
2015-05-29T00:57:51+01:00 2015-05-29T00:57:51+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1333&p=1821#p1821 <![CDATA[Project Showcase • Re: Yet Another DIY Bluetooth RC Car]]>
Code:
Index: Application/src/main/res/layout/fragment_bluetooth_chat.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- Application/src/main/res/layout/fragment_bluetooth_chat.xml   (revision )
+++ Application/src/main/res/layout/fragment_bluetooth_chat.xml   (revision )
@@ -17,15 +17,17 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
-              android:orientation="vertical" >
+              android:orientation="vertical"
+    android:weightSum="1">
 
     <ListView
         android:id="@+id/in"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:layout_weight="1"
+        android:layout_height="63dp"
         android:stackFromBottom="true"
-        android:transcriptMode="alwaysScroll" />
+        android:transcriptMode="alwaysScroll"
+        android:layout_weight="0.70"
+        android:clickable="false" />
 
     <LinearLayout
         android:layout_width="match_parent"
@@ -44,6 +46,64 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/send" />
+    </LinearLayout>
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="63dp"
+        android:orientation="horizontal" >
+
+        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="horizontal"
+            android:gravity="center_horizontal">
+
+            <Button
+            android:id="@+id/button_pf"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Forward \nFull" />
+
+            <Button
+                android:id="@+id/button_tf"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Reverse \nFull" />
+
+            <Button
+                android:id="@+id/button_s"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Full \nStop" />
+        </LinearLayout>
+    </LinearLayout>
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="63dp"
+        android:orientation="horizontal"
+        android:gravity="right">
+
+        <SeekBar
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:id="@+id/SteeringBar"
+            android:max="30"
+            android:clickable="true"
+            android:longClickable="true"
+            android:progress="15"
+            android:mirrorForRtl="false"
+            android:layout_weight="0.10" />
+
+        <SeekBar
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:id="@+id/ThrottleBar"
+            android:layout_weight="0.10"
+            android:progress="15"
+            android:max="15"
+            android:clickable="true"
+            android:longClickable="true" />
+
     </LinearLayout>
 
-</LinearLayout>
+</LinearLayout>
\ No newline at end of file


Code:
Index: Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>windows-1252
===================================================================
--- Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java   (revision )
+++ Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java   (revision )
@@ -39,6 +39,8 @@
 import android.widget.Button;
 import android.widget.EditText;
 import android.widget.ListView;
+import android.widget.ProgressBar;
+import android.widget.SeekBar;
 import android.widget.TextView;
 import android.widget.Toast;
 
@@ -60,7 +62,19 @@
     private ListView mConversationView;
     private EditText mOutEditText;
     private Button mSendButton;
+/*    private Button mRFButton;
+    private Button mLFButton;*/
+    private Button mDCButton;
+    private Button mPFButton;
+   //private Button mP8Button;
+   // private Button mP5Button;
+    private Button mTFButton;
+   // private Button mT5Button;
+    private Button mStopButton;
+    SeekBar mSteeringBar;
+    SeekBar mThrottleBar;
 
+
     /**
      * Name of the connected device
      */
@@ -151,8 +165,15 @@
         mConversationView = (ListView) view.findViewById(R.id.in);
         mOutEditText = (EditText) view.findViewById(R.id.edit_text_out);
         mSendButton = (Button) view.findViewById(R.id.button_send);
+        mPFButton = (Button) view.findViewById(R.id.button_pf);
+        mTFButton = (Button) view.findViewById(R.id.button_tf);
+        mStopButton = (Button) view.findViewById(R.id.button_s);
+        mSteeringBar = (SeekBar) view.findViewById(R.id.SteeringBar);
+        mThrottleBar = (SeekBar) view.findViewById(R.id.ThrottleBar);
+
     }
 
+
     /**
      * Set up the UI and background operations for chat.
      */
@@ -180,12 +201,106 @@
             }
         });
 
+        mPFButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                  //  mPFButton.setBackgroundColor(0x00FF00);
+                  //  mTFButton.setBackgroundColor(0xFF0000);
+                   mPFButton.setTextColor(0xff0000);
+                   mTFButton.setTextColor(0x00ff00);
+                }
+
+            }
+        });
+
+        mTFButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    //endMessage("TF");
+                    //mPFButton.setBackgroundColor(0xFF00);
+                   // mTFButton.setBackgroundColor(0x00FF00);
+                   mPFButton.setTextColor(0x00FF00);
+                   mTFButton.setTextColor(0xFF0000);
+                }
+
+            }
+        });
+
+        mStopButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    sendMessage("S");
+                }
+            }
+        });
+
+        mSteeringBar.setOnSeekBarChangeListener(
+                new SeekBar.OnSeekBarChangeListener() {
+
+                    @Override
+                    public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
+                        int aposition = i - 15;
+                        String message = "";
+                        if (aposition < 0) {
+                            aposition = -aposition;
+                            message = "L".concat(Integer.toHexString(aposition));
+                        } else {
+                            message = "R".concat(Integer.toHexString(aposition));
+                        }
+                        sendMessage(message);
+                    }
+
+                    @Override
+                    public void onStartTrackingTouch(SeekBar seekBar) {
+                        // TODO Auto-generated method stub
+                    }
+
+                    @Override
+                    public void onStopTrackingTouch(SeekBar seekBar) {
+                        // TODO Auto-generated method stub
+                        seekBar.setProgress(15);
+                    }
+                });
+
+        mThrottleBar.setOnSeekBarChangeListener(
+                new SeekBar.OnSeekBarChangeListener() {
+
+                    @Override
+                    public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
+                        int aposition = 15-i;
+                        String message = "";
+                        if (mPFButton.getCurrentTextColor() == 0xff0000){
+                            message = "P".concat(Integer.toHexString(aposition));
+                        }
+                        if (mTFButton.getCurrentTextColor() == 0xff0000){
+                            message = "T".concat(Integer.toHexString(aposition));
+                        }
+                        sendMessage(message);
+                    }
+
+                    @Override
+                    public void onStartTrackingTouch(SeekBar seekBar) {
+
+                    }
+
+                    @Override
+                    public void onStopTrackingTouch(SeekBar seekBar) {
+                        seekBar.setProgress(15);
+                    }
+                }
+        );
+
         // Initialize the BluetoothChatService to perform bluetooth connections
         mChatService = new BluetoothChatService(getActivity(), mHandler);
 
         // Initialize the buffer for outgoing messages
         mOutStringBuffer = new StringBuffer("");
     }
+
+
 
     /**
      * Makes this device discoverable.

Statistics: Posted by el_es — Fri May 29, 2015 12:57 am


]]>
2015-05-28T23:35:20+01:00 2015-05-28T23:35:20+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1333&p=1820#p1820 <![CDATA[Project Showcase • Re: Yet Another DIY Bluetooth RC Car]]> also i finally got what the AS wanted of me... the prototype of the OnSeekBarChangeListener onProgressChanged to implement, looks different...

Code:
mSteeringBar.setOnSeekBarChangeListener(
                new SeekBar.OnSeekBarChangeListener() {

                    @Override
                    public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// i had something else ;) even if still technically same types of variables...
                        int aposition = i - 16;
                        String message = "";
                        if (aposition < 0) {
                            aposition = -aposition;
                            message = "L".concat( Integer.toHexString(aposition));
                        }
                        else
                        {
                            message = "R".concat(Integer.toHexString(aposition));
                        }
                        sendMessage(message);
                    }

                    @Override
                    public void onStartTrackingTouch(SeekBar seekBar) {
                        // TODO Auto-generated method stub
                    }

                    @Override
                    public void onStopTrackingTouch(SeekBar seekBar) {
                        // TODO Auto-generated method stub
                    }
                });

So now onwards to do a fully on-sliders app ;)

Statistics: Posted by el_es — Thu May 28, 2015 11:35 pm


]]>
2015-05-28T23:20:25+01:00 2015-05-28T23:20:25+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1333&p=1819#p1819 <![CDATA[Project Showcase • Re: Yet Another DIY Bluetooth RC Car]]> having been sitting on this problem till 1am in the morning, probably did not help my understanding either ;)

however, to me java is one of the less understandable languages :) Pascal Forever ;)

Statistics: Posted by el_es — Thu May 28, 2015 11:20 pm


]]>
2015-05-27T23:08:01+01:00 2015-05-27T23:08:01+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1333&p=1818#p1818 <![CDATA[Project Showcase • Re: Yet Another DIY Bluetooth RC Car]]>
I think that what your compiler is saying is that you also need to provide an override for the method onStopTrackingTouch. This question on stackoverflow has a snippet which looks similar. So bascially you may have some joy by adding these 2 overrides

Code:
@Override
    public void onStartTrackingTouch(SeekBar seekBar) {
        // TODO Auto-generated method stub
    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
        // TODO Auto-generated method stub
    }


Regards

Alan

Statistics: Posted by Alan — Wed May 27, 2015 11:08 pm


]]>
2015-05-27T00:24:06+01:00 2015-05-27T00:24:06+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1333&p=1817#p1817 <![CDATA[Project Showcase • Re: Yet Another DIY Bluetooth RC Car]]>
Code:
//        mSteeringBar.setOnSeekBarChangeListener(
//                new SeekBar.OnSeekBarChangeListener() {
^^^^^ when uncommented, this line goes red with error below ^^^^^^^
//                    @Override
//                    public void OnProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
//                        int aposition = progress - 16;
//                        String message = "";
//                        if (aposition < 0) {
//                            aposition = -aposition;
//                            message = "L".concat( Integer.toHexString(aposition));
//                        }
//                        else
//                        {
//                            message = "R".concat(Integer.toHexString(aposition));
//                        }
//                        sendMessage(message);
//                    }
//                });

It's in comments, because it won't let me :(
it says

Error:(287, 55) error: <anonymous com.example.android.bluetoothchat.BluetoothChatFragment$11> is not abstract and does not override abstract method onStopTrackingTouch(SeekBar) in OnSeekBarChangeListener


Pls help, I so don't understand this error :(

Statistics: Posted by el_es — Wed May 27, 2015 12:24 am


]]>
2015-05-24T23:40:34+01:00 2015-05-24T23:40:34+01:00 http://forum.dawnrobotics.co.uk/viewtopic.php?t=1333&p=1811#p1811 <![CDATA[Project Showcase • Re: Yet Another DIY Bluetooth RC Car]]> and it goes well, as far as sending text commands at button press can go :)

Also the discussion about b/o protection just about to take an unexpected turn: i changed batteries for a new set of 5 x aaa...

and now, pf and tf command does not brown out any more :) and the speed, it's MASSIVE :)
can't wait to test it outdoors.

In the mean time, also looking which way better to share what I wrote...

I will paste patches into this post.
(I changed the BluetoothChatFragment.java and fragment_bluetooth_chat.xml and the BluetoothChatService.java)

Code:
Index: Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatService.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>windows-1252
===================================================================
--- Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatService.java   (revision )
+++ Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatService.java   (revision )
@@ -46,11 +46,11 @@
     private static final String NAME_SECURE = "BluetoothChatSecure";
     private static final String NAME_INSECURE = "BluetoothChatInsecure";
 
-    // Unique UUID for this application
+    // Unique UUID for this application  // el_es : serial port profile UUID
     private static final UUID MY_UUID_SECURE =
-            UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");
+            UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");  //fa87c0d0-afac-11de-8a39-0800200c9a66");
     private static final UUID MY_UUID_INSECURE =
-            UUID.fromString("8ce255c0-200a-11e0-ac64-0800200c9a66");
+            UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");  //8ce255c0-200a-11e0-ac64-0800200c9a66");
 
     // Member fields
     private final BluetoothAdapter mAdapter;


Code:
Index: Application/src/main/res/layout/fragment_bluetooth_chat.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- Application/src/main/res/layout/fragment_bluetooth_chat.xml   (revision )
+++ Application/src/main/res/layout/fragment_bluetooth_chat.xml   (revision )
@@ -45,5 +45,68 @@
             android:layout_height="wrap_content"
             android:text="@string/send" />
     </LinearLayout>
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="63dp"
+        android:orientation="horizontal" >
+        <Button
+            android:id="@+id/button_lf"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Left \nFull" />
+        <Button
+            android:id="@+id/button_dc"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Dir \nCenter" />
+        <Button
+            android:id="@+id/button_rf"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Right \nFull" />
+        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="horizontal"
+            android:gravity="right">
+            <Button
+            android:id="@+id/button_pf"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Forward \nFull" />
+            <Button
+            android:id="@+id/button_p8"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Forward \nHalf" />
+            <Button
+                android:id="@+id/button_p5"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="Forward \nQuarter" />
+
+        </LinearLayout>
+    </LinearLayout>
+    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="63dp"
+        android:orientation="horizontal"
+        android:gravity="right">
+        <Button
+            android:id="@+id/button_tf"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Reverse \nFull" />
+        <Button
+            android:id="@+id/button_t5"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Reverse \nQuarter" />
+        <Button
+            android:id="@+id/button_s"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="Full \nStop" />
+        </LinearLayout>
 
 </LinearLayout>


Code:
Index: Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>windows-1252
===================================================================
--- Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java   (revision )
+++ Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java   (revision )
@@ -60,6 +60,15 @@
     private ListView mConversationView;
     private EditText mOutEditText;
     private Button mSendButton;
+    private Button mRFButton;
+    private Button mLFButton;
+    private Button mDCButton;
+    private Button mPFButton;
+    private Button mP8Button;
+    private Button mP5Button;
+    private Button mTFButton;
+    private Button mT5Button;
+    private Button mStopButton;
 
     /**
      * Name of the connected device
@@ -151,6 +160,15 @@
         mConversationView = (ListView) view.findViewById(R.id.in);
         mOutEditText = (EditText) view.findViewById(R.id.edit_text_out);
         mSendButton = (Button) view.findViewById(R.id.button_send);
+        mRFButton = (Button) view.findViewById(R.id.button_rf);
+        mLFButton = (Button) view.findViewById(R.id.button_lf);
+        mDCButton = (Button) view.findViewById(R.id.button_dc);
+        mPFButton = (Button) view.findViewById(R.id.button_pf);
+        mP8Button = (Button) view.findViewById(R.id.button_p8);
+        mP5Button = (Button) view.findViewById(R.id.button_p5);
+        mTFButton = (Button) view.findViewById(R.id.button_tf);
+        mT5Button = (Button) view.findViewById(R.id.button_t5);
+        mStopButton = (Button) view.findViewById(R.id.button_s);
     }
 
     /**
@@ -176,6 +194,84 @@
                     TextView textView = (TextView) view.findViewById(R.id.edit_text_out);
                     String message = textView.getText().toString();
                     sendMessage(message);
+                }
+            }
+        });
+
+        mRFButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    sendMessage("RF");
+                }
+            }
+        });
+
+        mDCButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    sendMessage("L0");
+                }
+            }
+        });
+
+        mLFButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    sendMessage("LF");
+                }
+            }
+        });
+
+        mPFButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    sendMessage("PF");
+                }
+            }
+        });
+        mP8Button.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    sendMessage("P8");
+                }
+            }
+        });
+        mP5Button.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    sendMessage("P5");
+                }
+            }
+        });
+        mTFButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    sendMessage("TF");
+                }
+            }
+        });
+
+        mT5Button.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    sendMessage("T5");
+                }
+            }
+        });
+
+        mStopButton.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                View view = getView();
+                if (null != view) {
+                    sendMessage("S");
                 }
             }
         });

Statistics: Posted by el_es — Sun May 24, 2015 11:40 pm


]]>