Statistics: Posted by el_es — Mon Jun 01, 2015 7:13 pm
Statistics: Posted by el_es — Mon Jun 01, 2015 7:03 pm
SensorActivity mSensorActivity; // This goes with the other member variables
mSensorActivity = new SensorActivity(); // This goes wherever your setup code is
Statistics: Posted by Alan — Mon Jun 01, 2015 12:41 pm
Statistics: Posted by el_es — Sat May 30, 2015 9:12 pm
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
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
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
}
});
Statistics: Posted by el_es — Thu May 28, 2015 11:35 pm
Statistics: Posted by el_es — Thu May 28, 2015 11:20 pm
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
Statistics: Posted by Alan — Wed May 27, 2015 11:08 pm
// 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);
// }
// });
Error:(287, 55) error: <anonymous com.example.android.bluetoothchat.BluetoothChatFragment$11> is not abstract and does not override abstract method onStopTrackingTouch(SeekBar) in OnSeekBarChangeListener
Statistics: Posted by el_es — Wed May 27, 2015 12:24 am
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;
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>
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
Statistics: Posted by el_es — Fri May 22, 2015 6:46 pm
Statistics: Posted by Alan — Fri May 22, 2015 9:20 am
Statistics: Posted by el_es — Thu May 21, 2015 11:24 pm
Statistics: Posted by el_es — Thu May 21, 2015 9:36 pm
Flash corruption can easily be avoided by following these design recommendations (one is
sufficient):
1. If there is no need for a Boot Loader update in the system, program the Boot Loader Lock
Bits to prevent any Boot Loader software updates
2. Keep the AVR RESET active (low) during periods of insufficient power supply voltage.
This can be done by enabling the internal Brown-out Detector (BOD) if the operating volt-
age matches the detection level. If not, an external low VCC Reset Protection circuit can
be used. If a reset occurs while a write operation is in progress, the write operation will be
completed provided that the power supply voltage is sufficient
3. Keep the AVR core in Power-down sleep mode during periods of low VCC. This will pre-
vent the CPU from attempting to decode and execute instructions, effectively protecting
the SPMCR Register and thus the Flash from unintentional writes
Statistics: Posted by Alan — Thu May 21, 2015 3:12 pm