├── .DS_Store
├── AndroidDevice
├── .DS_Store
├── .classpath
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.ltk.core.refactoring.prefs
├── AndroidManifest.xml
├── bin
│ ├── AndroidManifest.xml
│ ├── br.eti.caratti.MiniStepperATU.apk
│ ├── classes.dex
│ ├── classes
│ │ ├── .DS_Store
│ │ └── br
│ │ │ ├── .DS_Store
│ │ │ └── eti
│ │ │ ├── .DS_Store
│ │ │ └── caratti
│ │ │ ├── .DS_Store
│ │ │ └── AntennaTuner
│ │ │ ├── BluetoothService$AcceptThread.class
│ │ │ ├── BluetoothService$ConnectThread.class
│ │ │ ├── BluetoothService$ConnectedThread.class
│ │ │ ├── BluetoothService.class
│ │ │ ├── BluetoothTuner$1.class
│ │ │ ├── BluetoothTuner.class
│ │ │ ├── BuildConfig.class
│ │ │ ├── DeviceListActivity$1.class
│ │ │ ├── DeviceListActivity$2.class
│ │ │ ├── DeviceListActivity$3.class
│ │ │ ├── DeviceListActivity.class
│ │ │ ├── R$attr.class
│ │ │ ├── R$drawable.class
│ │ │ ├── R$id.class
│ │ │ ├── R$layout.class
│ │ │ ├── R$menu.class
│ │ │ ├── R$string.class
│ │ │ └── R.class
│ ├── dexedLibs
│ │ └── annotations-ec7bffb9eb966af301080859fac531e6.jar
│ ├── jarlist.cache
│ ├── res
│ │ ├── crunch
│ │ │ ├── drawable-hdpi
│ │ │ │ └── app_icon.png
│ │ │ └── drawable
│ │ │ │ └── app_icon.png
│ │ ├── drawable-hdpi
│ │ │ └── app_icon.png
│ │ └── drawable
│ │ │ └── app_icon.png
│ └── resources.ap_
├── gen
│ └── br
│ │ └── eti
│ │ └── caratti
│ │ └── AntennaTuner
│ │ ├── BuildConfig.java
│ │ └── R.java
├── project.properties
├── res
│ ├── .DS_Store
│ ├── drawable-hdpi
│ │ └── app_icon.png
│ ├── drawable
│ │ └── app_icon.png
│ ├── layout
│ │ ├── custom_title.xml
│ │ ├── device_list.xml
│ │ ├── device_name.xml
│ │ ├── main.xml
│ │ └── message.xml
│ ├── menu
│ │ └── option_menu.xml
│ └── values
│ │ └── strings.xml
└── src
│ ├── .DS_Store
│ └── br
│ ├── .DS_Store
│ └── eti
│ ├── .DS_Store
│ └── caratti
│ ├── .DS_Store
│ └── AntennaTuner
│ ├── BluetoothService.java
│ ├── BluetoothTuner.java
│ └── DeviceListActivity.java
├── Arduino
├── .DS_Store
└── controle_antena_android_mini_motor.ino
├── Desenvolvimento de Hardware e Software para controlar uma Antena Loop remotamente por meio de um dispositivo Android.docx
├── Mini_stepper_motor.fzz
├── Mini_stepper_motor_schematic.jpg
└── README.txt
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/AndroidDevice/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | br.eti.caratti.MiniStepperATU
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/AndroidDevice/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.5
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.source=1.5
12 |
--------------------------------------------------------------------------------
/AndroidDevice/.settings/org.eclipse.ltk.core.refactoring.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
3 |
--------------------------------------------------------------------------------
/AndroidDevice/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
21 |
22 |
23 |
24 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/AndroidDevice/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
20 |
21 |
22 |
23 |
24 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/AndroidDevice/bin/br.eti.caratti.MiniStepperATU.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/br.eti.caratti.MiniStepperATU.apk
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes.dex
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothService$AcceptThread.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothService$AcceptThread.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothService$ConnectThread.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothService$ConnectThread.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothService$ConnectedThread.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothService$ConnectedThread.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothService.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothTuner$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothTuner$1.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothTuner.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BluetoothTuner.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/BuildConfig.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/DeviceListActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/DeviceListActivity$1.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/DeviceListActivity$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/DeviceListActivity$2.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/DeviceListActivity$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/DeviceListActivity$3.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/DeviceListActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/DeviceListActivity.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$attr.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$drawable.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$id.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$layout.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$menu.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$menu.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R$string.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/classes/br/eti/caratti/AntennaTuner/R.class
--------------------------------------------------------------------------------
/AndroidDevice/bin/dexedLibs/annotations-ec7bffb9eb966af301080859fac531e6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/dexedLibs/annotations-ec7bffb9eb966af301080859fac531e6.jar
--------------------------------------------------------------------------------
/AndroidDevice/bin/jarlist.cache:
--------------------------------------------------------------------------------
1 | # cache for current jar dependecy. DO NOT EDIT.
2 | # format is
3 | # Encoding is UTF-8
4 |
--------------------------------------------------------------------------------
/AndroidDevice/bin/res/crunch/drawable-hdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/res/crunch/drawable-hdpi/app_icon.png
--------------------------------------------------------------------------------
/AndroidDevice/bin/res/crunch/drawable/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/res/crunch/drawable/app_icon.png
--------------------------------------------------------------------------------
/AndroidDevice/bin/res/drawable-hdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/res/drawable-hdpi/app_icon.png
--------------------------------------------------------------------------------
/AndroidDevice/bin/res/drawable/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/res/drawable/app_icon.png
--------------------------------------------------------------------------------
/AndroidDevice/bin/resources.ap_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/bin/resources.ap_
--------------------------------------------------------------------------------
/AndroidDevice/gen/br/eti/caratti/AntennaTuner/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package br.eti.caratti.AntennaTuner;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/AndroidDevice/gen/br/eti/caratti/AntennaTuner/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package br.eti.caratti.AntennaTuner;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class drawable {
14 | public static final int app_icon=0x7f020000;
15 | }
16 | public static final class id {
17 | public static final int AbsoluteLayout1=0x7f060007;
18 | public static final int button1=0x7f060016;
19 | public static final int button2=0x7f060014;
20 | public static final int button3=0x7f060015;
21 | public static final int button4=0x7f06000c;
22 | public static final int button_scan=0x7f060006;
23 | public static final int discoverable=0x7f060019;
24 | public static final int fastLeftTuning=0x7f06000d;
25 | public static final int fastRightTuning=0x7f060013;
26 | public static final int leftTuning=0x7f06000e;
27 | public static final int maxTuning=0x7f06000b;
28 | public static final int minTuning=0x7f060017;
29 | public static final int new_devices=0x7f060005;
30 | public static final int paired_devices=0x7f060003;
31 | public static final int rightTuning=0x7f06000f;
32 | public static final int scan=0x7f060018;
33 | public static final int textView1=0x7f060011;
34 | public static final int textView2=0x7f060012;
35 | public static final int textView3=0x7f060008;
36 | public static final int textView4=0x7f060009;
37 | public static final int textView5=0x7f06000a;
38 | public static final int textView6=0x7f060010;
39 | public static final int title_left_text=0x7f060000;
40 | public static final int title_new_devices=0x7f060004;
41 | public static final int title_paired_devices=0x7f060002;
42 | public static final int title_right_text=0x7f060001;
43 | }
44 | public static final class layout {
45 | public static final int custom_title=0x7f030000;
46 | public static final int device_list=0x7f030001;
47 | public static final int device_name=0x7f030002;
48 | public static final int main=0x7f030003;
49 | public static final int message=0x7f030004;
50 | }
51 | public static final class menu {
52 | public static final int option_menu=0x7f050000;
53 | }
54 | public static final class string {
55 | public static final int app_name=0x7f040000;
56 | public static final int bt_not_enabled_leaving=0x7f040003;
57 | public static final int button_scan=0x7f04000d;
58 | /** Options Menu
59 | */
60 | public static final int connect=0x7f04000e;
61 | public static final int discoverable=0x7f04000f;
62 | public static final int none_found=0x7f04000a;
63 | public static final int none_paired=0x7f040009;
64 | public static final int not_connected=0x7f040002;
65 | /** DeviceListActivity
66 | */
67 | public static final int scanning=0x7f040007;
68 | public static final int select_device=0x7f040008;
69 | /** BluetoothChat
70 | */
71 | public static final int send=0x7f040001;
72 | public static final int title_connected_to=0x7f040005;
73 | public static final int title_connecting=0x7f040004;
74 | public static final int title_not_connected=0x7f040006;
75 | public static final int title_other_devices=0x7f04000c;
76 | public static final int title_paired_devices=0x7f04000b;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/AndroidDevice/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-16
15 |
--------------------------------------------------------------------------------
/AndroidDevice/res/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/res/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/res/drawable-hdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/res/drawable-hdpi/app_icon.png
--------------------------------------------------------------------------------
/AndroidDevice/res/drawable/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/res/drawable/app_icon.png
--------------------------------------------------------------------------------
/AndroidDevice/res/layout/custom_title.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
30 |
39 |
--------------------------------------------------------------------------------
/AndroidDevice/res/layout/device_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
30 |
36 |
45 |
51 |
56 |
--------------------------------------------------------------------------------
/AndroidDevice/res/layout/device_name.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/AndroidDevice/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
23 |
27 |
28 |
29 |
30 |
38 |
39 |
47 |
48 |
56 |
57 |
65 |
66 |
74 |
75 |
83 |
84 |
92 |
93 |
101 |
102 |
110 |
111 |
120 |
121 |
129 |
130 |
138 |
139 |
147 |
148 |
156 |
157 |
165 |
166 |
174 |
175 |
183 |
184 |
--------------------------------------------------------------------------------
/AndroidDevice/res/layout/message.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/AndroidDevice/res/menu/option_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
24 |
--------------------------------------------------------------------------------
/AndroidDevice/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 | Antenna Tuner
19 |
20 |
21 | Send
22 | You are not connected to a device
23 | Bluetooth was not enabled. Leaving Bluetooth Chat.
24 | connecting...
25 | connected:
26 | not connected
27 |
28 |
29 | scanning for devices...
30 | select a device to connect
31 | No devices have been paired
32 | No devices found
33 | Paired Devices
34 | Other Available Devices
35 | Scan for devices
36 |
37 |
38 | Connect a device
39 | Make discoverable
40 |
41 |
--------------------------------------------------------------------------------
/AndroidDevice/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/src/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/src/br/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/src/br/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/src/br/eti/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/src/br/eti/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/src/br/eti/caratti/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/AndroidDevice/src/br/eti/caratti/.DS_Store
--------------------------------------------------------------------------------
/AndroidDevice/src/br/eti/caratti/AntennaTuner/BluetoothService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * This code was an mConnectedThreadadaptation of BluetoothChat that came with Android SDK samples
17 | * This adaptation was made by Ricardo Lima Caratti, Ham radio, Callsign PU2CLR.
18 | * Brazil, 8/11/2012
19 | *
20 | */
21 |
22 | package br.eti.caratti.AntennaTuner;
23 |
24 | import java.io.IOException;
25 | import java.io.InputStream;
26 | import java.io.OutputStream;
27 | import java.util.UUID;
28 |
29 | import android.annotation.SuppressLint;
30 | import android.bluetooth.BluetoothAdapter;
31 | import android.bluetooth.BluetoothDevice;
32 | import android.bluetooth.BluetoothServerSocket;
33 | import android.bluetooth.BluetoothSocket;
34 | import android.content.Context;
35 | import android.os.Bundle;
36 | import android.os.Handler;
37 | import android.os.Message;
38 |
39 | /**
40 | * This class does all the work for setting up and managing Bluetooth
41 | * connections with other devices. It has a thread that listens for
42 | * incoming connections, a thread for connecting with a device, and a
43 | * thread for performing data transmissions when connected.
44 | */
45 | @SuppressLint("NewApi")
46 | public class BluetoothService {
47 |
48 | // Name for the SDP record when creating server socket
49 | private static final String NAME = "AntennaTuner";
50 |
51 | // Unique UUID for this application
52 | private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
53 | // private static final UUID MY_UUID = UUID.fromString("FA87C0D0-AFAC-11DE-8A39-0800200C9A66");
54 | // private static final UUID MY_UUID = UUID.fromString("00000000-0000-0000-0000-000000000000");
55 | // private static final UUID MY_UUID = null;
56 | // Member fields
57 |
58 | private final BluetoothAdapter bluetoothAdapter;
59 | private final Handler bluetoothHandler;
60 | private AcceptThread acceptThread;
61 | private ConnectThread connectThread;
62 | private ConnectedThread connectedThread;
63 | private int bluetoothState;
64 |
65 | // Constants that indicate the current connection state
66 | public static final int STATE_NONE = 0; // we're doing nothing
67 | public static final int STATE_LISTEN = 1; // now listening for incoming connections
68 | public static final int STATE_CONNECTING = 2; // now initiating an outgoing connection
69 | public static final int STATE_CONNECTED = 3; // now connected to a remote device
70 |
71 | /**
72 | * Constructor. Prepares a new BluetoothChat session.
73 | * @param context The UI Activity Context
74 | * @param handler A Handler to send messages back to the UI Activity
75 | */
76 | public BluetoothService(Context context, Handler handler) {
77 | bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
78 | bluetoothState = STATE_NONE;
79 | bluetoothHandler = handler;
80 | }
81 |
82 | /**
83 | * Set the current state of the chat connection
84 | * @param state An integer defining the current connection state
85 | */
86 | private synchronized void setState(int state) {
87 | bluetoothState = state;
88 |
89 | // Give the new state to the Handler so the UI Activity can update
90 | bluetoothHandler.obtainMessage(BluetoothTuner.MESSAGE_STATE_CHANGE, state, -1).sendToTarget();
91 | }
92 |
93 | /**
94 | * Return the current connection state. */
95 | public synchronized int getState() {
96 | return bluetoothState;
97 | }
98 |
99 | /**
100 | * Start the chat service. Specifically start AcceptThread to begin a
101 | * session in listening (server) mode. Called by the Activity onResume() */
102 | public synchronized void start() {
103 |
104 | // Cancel any thread attempting to make a connection
105 | if (connectThread != null) {connectThread.cancel(); connectThread = null;}
106 |
107 | // Cancel any thread currently running a connection
108 | if (connectedThread != null) {connectedThread.cancel(); connectedThread = null;}
109 |
110 | // Start the thread to listen on a BluetoothServerSocket
111 | if (acceptThread == null) {
112 | acceptThread = new AcceptThread();
113 | acceptThread.start();
114 | }
115 | setState(STATE_LISTEN);
116 | }
117 |
118 | /**
119 | * Start the ConnectThread to initiate a connection to a remote device.
120 | * @param device The BluetoothDevice to connect
121 | */
122 | public synchronized void connect(BluetoothDevice device) {
123 |
124 | // Cancel any thread attempting to make a connection
125 | if (bluetoothState == STATE_CONNECTING) {
126 | if (connectThread != null) {connectThread.cancel(); connectThread = null;}
127 | }
128 |
129 | // Cancel any thread currently running a connection
130 | if (connectedThread != null) {connectedThread.cancel(); connectedThread = null;}
131 |
132 | // Start the thread to connect with the given device
133 | connectThread = new ConnectThread(device);
134 | connectThread.start();
135 | setState(STATE_CONNECTING);
136 | }
137 |
138 | /**
139 | * Start the ConnectedThread to begin managing a Bluetooth connection
140 | * @param socket The BluetoothSocket on which the connection was made
141 | * @param device The BluetoothDevice that has been connected
142 | */
143 | public synchronized void connected(BluetoothSocket socket, BluetoothDevice device) {
144 |
145 | // Cancel the thread that completed the connection
146 | if (connectThread != null) {connectThread.cancel(); connectThread = null;}
147 |
148 | // Cancel any thread currently running a connection
149 | if (connectedThread != null) {connectedThread.cancel(); connectedThread = null;}
150 |
151 | // Cancel the accept thread because we only want to connect to one device
152 | if (acceptThread != null) {acceptThread.cancel(); acceptThread = null;}
153 |
154 | // Start the thread to manage the connection and perform transmissions
155 | connectedThread = new ConnectedThread(socket);
156 | connectedThread.start();
157 |
158 | // Send the name of the connected device back to the UI Activity
159 | Message msg = bluetoothHandler.obtainMessage(BluetoothTuner.MESSAGE_DEVICE_NAME);
160 | Bundle bundle = new Bundle();
161 | bundle.putString(BluetoothTuner.DEVICE_NAME, device.getName());
162 | msg.setData(bundle);
163 | bluetoothHandler.sendMessage(msg);
164 |
165 | setState(STATE_CONNECTED);
166 | }
167 |
168 | /**
169 | * Stop all threads
170 | */
171 | public synchronized void stop() {
172 | if (connectThread != null) {connectThread.cancel(); connectThread = null;}
173 | if (connectedThread != null) {connectedThread.cancel(); connectedThread = null;}
174 | if (acceptThread != null) {acceptThread.cancel(); acceptThread = null;}
175 | setState(STATE_NONE);
176 | }
177 |
178 | /**
179 | * Write to the ConnectedThread in an unsynchronized manner
180 | * @param out The bytes to write
181 | * @see ConnectedThread#write(byte[])
182 | */
183 | public void write(byte[] out) {
184 | // Create temporary object
185 | ConnectedThread r;
186 | // Synchronize a copy of the ConnectedThread
187 | synchronized (this) {
188 | if (bluetoothState != STATE_CONNECTED) return;
189 | r = connectedThread;
190 | }
191 | // Perform the write unsynchronized
192 | r.write(out);
193 | }
194 |
195 | /**
196 | * Indicate that the connection attempt failed and notify the UI Activity.
197 | */
198 | private void connectionFailed() {
199 | setState(STATE_LISTEN);
200 |
201 | // Send a failure message back to the Activity
202 | Message msg = bluetoothHandler.obtainMessage(BluetoothTuner.MESSAGE_TOAST);
203 | Bundle bundle = new Bundle();
204 | bundle.putString(BluetoothTuner.TOAST, "Unable to connect device");
205 | msg.setData(bundle);
206 | bluetoothHandler.sendMessage(msg);
207 | }
208 |
209 | /**
210 | * Indicate that the connection was lost and notify the UI Activity.
211 | */
212 | private void connectionLost() {
213 | setState(STATE_LISTEN);
214 |
215 | // Send a failure message back to the Activity
216 | Message msg = bluetoothHandler.obtainMessage(BluetoothTuner.MESSAGE_TOAST);
217 | Bundle bundle = new Bundle();
218 | bundle.putString(BluetoothTuner.TOAST, "Device connection was lost");
219 | msg.setData(bundle);
220 | bluetoothHandler.sendMessage(msg);
221 | }
222 |
223 | /**
224 | * This thread runs while listening for incoming connections. It behaves
225 | * like a server-side client. It runs until a connection is accepted
226 | * (or until cancelled).
227 | */
228 | private class AcceptThread extends Thread {
229 | // The local server socket
230 | private final BluetoothServerSocket mmServerSocket;
231 |
232 | public AcceptThread() {
233 | BluetoothServerSocket tmp = null;
234 |
235 | // Create a new listening server socket
236 | try {
237 | tmp = bluetoothAdapter.listenUsingRfcommWithServiceRecord(NAME, MY_UUID);
238 | } catch (IOException e) {
239 | e.printStackTrace();
240 | }
241 | mmServerSocket = tmp;
242 | }
243 |
244 | public void run() {
245 | setName("AcceptThread");
246 | BluetoothSocket socket = null;
247 |
248 | // Listen to the server socket if we're not connected
249 | while (bluetoothState != STATE_CONNECTED) {
250 | try {
251 | // This is a blocking call and will only return on a
252 | // successful connection or an exception
253 | socket = mmServerSocket.accept();
254 | } catch (IOException e) {
255 | break;
256 | }
257 |
258 | // If a connection was accepted
259 | if (socket != null) {
260 | synchronized (BluetoothService.this) {
261 | switch (bluetoothState) {
262 | case STATE_LISTEN:
263 | case STATE_CONNECTING:
264 | // Situation normal. Start the connected thread.
265 | connected(socket, socket.getRemoteDevice());
266 | break;
267 | case STATE_NONE:
268 | case STATE_CONNECTED:
269 | // Either not ready or already connected. Terminate new socket.
270 | try {
271 | socket.close();
272 | } catch (IOException e) {
273 |
274 | }
275 | break;
276 | }
277 | }
278 | }
279 | }
280 | }
281 |
282 | public void cancel() {
283 |
284 | try {
285 | mmServerSocket.close();
286 | } catch (IOException e) {
287 | }
288 | }
289 | }
290 |
291 |
292 | /**
293 | * This thread runs while attempting to make an outgoing connection
294 | * with a device. It runs straight through; the connection either
295 | * succeeds or fails.
296 | */
297 | private class ConnectThread extends Thread {
298 | private final BluetoothSocket mmSocket;
299 | private final BluetoothDevice mmDevice;
300 |
301 | public ConnectThread(BluetoothDevice device) {
302 | mmDevice = device;
303 | BluetoothSocket tmp = null;
304 |
305 | // Get a BluetoothSocket for a connection with the
306 | // given BluetoothDevice
307 | try {
308 | tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
309 | // The command below does not work on Android 4.0.3.
310 | // tmp = device.createInsecureRfcommSocketToServiceRecord(MY_UUID);
311 | } catch (IOException e) {
312 | }
313 | mmSocket = tmp;
314 | }
315 |
316 | public void run() {
317 | setName("ConnectThread");
318 |
319 | // Always cancel discovery because it will slow down a connection
320 | bluetoothAdapter.cancelDiscovery();
321 |
322 | // Make a connection to the BluetoothSocket
323 | try {
324 | // This is a blocking call and will only return on a
325 | // successful connection or an exception
326 | mmSocket.connect();
327 | } catch (IOException e) {
328 | connectionFailed();
329 | // Close the socket
330 | try {
331 | mmSocket.close();
332 | } catch (IOException e2) {
333 |
334 | }
335 | // Start the service over to restart listening mode
336 | BluetoothService.this.start();
337 | return;
338 | }
339 |
340 | // Reset the ConnectThread because we're done
341 | synchronized (BluetoothService.this) {
342 | connectThread = null;
343 | }
344 |
345 | // Start the connected thread
346 | connected(mmSocket, mmDevice);
347 | }
348 |
349 | public void cancel() {
350 | try {
351 | mmSocket.close();
352 | } catch (IOException e) {
353 |
354 | }
355 | }
356 | }
357 |
358 | /**
359 | * This thread runs during a connection with a remote device.
360 | * It handles all incoming and outgoing transmissions.
361 | */
362 | private class ConnectedThread extends Thread {
363 | private final BluetoothSocket mmSocket;
364 | private final InputStream mmInStream;
365 | private final OutputStream mmOutStream;
366 |
367 | public ConnectedThread(BluetoothSocket socket) {
368 |
369 | mmSocket = socket;
370 | InputStream tmpIn = null;
371 | OutputStream tmpOut = null;
372 |
373 | // Get the BluetoothSocket input and output streams
374 | try {
375 | tmpIn = socket.getInputStream();
376 | tmpOut = socket.getOutputStream();
377 | } catch (IOException e) {
378 |
379 | }
380 |
381 | mmInStream = tmpIn;
382 | mmOutStream = tmpOut;
383 | }
384 |
385 | public void run() {
386 |
387 | byte[] buffer = new byte[1024];
388 | int bytes;
389 |
390 | // Keep listening to the InputStream while connected
391 | while (true) {
392 | try {
393 | // Read from the InputStream
394 | bytes = mmInStream.read(buffer);
395 |
396 | // Send the obtained bytes to the UI Activity
397 | bluetoothHandler.obtainMessage(BluetoothTuner.MESSAGE_READ, bytes, -1, buffer)
398 | .sendToTarget();
399 | } catch (IOException e) {
400 | connectionLost();
401 | break;
402 | }
403 | }
404 | }
405 |
406 | /**
407 | * Write to the connected OutStream.
408 | * @param buffer The bytes to write
409 | */
410 | public void write(byte[] buffer) {
411 | try {
412 | mmOutStream.write(buffer);
413 |
414 | // Share the sent message back to the UI Activity
415 | bluetoothHandler.obtainMessage(BluetoothTuner.MESSAGE_WRITE, -1, -1, buffer)
416 | .sendToTarget();
417 | } catch (IOException e) {
418 |
419 | }
420 | }
421 |
422 | public void cancel() {
423 | try {
424 | mmSocket.close();
425 | } catch (IOException e) {
426 | }
427 | }
428 | }
429 | }
430 |
--------------------------------------------------------------------------------
/AndroidDevice/src/br/eti/caratti/AntennaTuner/BluetoothTuner.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * This code was an mConnectedThreadadaptation of BluetoothChat that came with Android SDK samples
17 | * This adaptation was made by Ricardo Lima Caratti, Ham radio, Callsign PU2CLR.
18 | * Brazil, 8/11/2012
19 | *
20 | *
21 | */
22 |
23 | package br.eti.caratti.AntennaTuner;
24 |
25 | import android.annotation.SuppressLint;
26 | import android.app.Activity;
27 | import android.app.TabActivity;
28 | import android.bluetooth.BluetoothAdapter;
29 | import android.bluetooth.BluetoothDevice;
30 | import android.content.Intent;
31 | import android.os.Bundle;
32 | import android.os.Handler;
33 | import android.os.Message;
34 | import android.view.Menu;
35 | import android.view.MenuInflater;
36 | import android.view.MenuItem;
37 | import android.view.View;
38 | import android.view.Window;
39 | import android.widget.TabHost;
40 | import android.widget.TextView;
41 | import android.widget.Toast;
42 |
43 | /**
44 | * This Activity presents the Antenna Tuner controls .
45 | */
46 | @SuppressLint("NewApi")
47 | public class BluetoothTuner extends Activity {
48 |
49 |
50 | // Message types sent from the BluetoothChatService Handler
51 | public static final int MESSAGE_STATE_CHANGE = 1;
52 | public static final int MESSAGE_READ = 2;
53 | public static final int MESSAGE_WRITE = 3;
54 | public static final int MESSAGE_DEVICE_NAME = 4;
55 | public static final int MESSAGE_TOAST = 5;
56 |
57 | // Key names received from the BluetoothChatService Handler
58 | public static final String DEVICE_NAME = "device_name";
59 | public static final String TOAST = "toast";
60 |
61 | // Intent request codes
62 | private static final int REQUEST_CONNECT_DEVICE = 1;
63 | private static final int REQUEST_ENABLE_BT = 2;
64 |
65 | // Layout Views
66 | private TextView titleApp;
67 | // Name of the connected device
68 | private String connectedDeviceName = null;
69 |
70 | // Local Bluetooth adapter
71 | private BluetoothAdapter bluetoothAdapter = null;
72 | // Member object for the chat services
73 | private BluetoothService tunerService = null;
74 |
75 |
76 | TabHost tabHost;
77 |
78 | @Override
79 | public void onCreate(Bundle savedInstanceState) {
80 | super.onCreate(savedInstanceState);
81 |
82 |
83 | // Set up the window layout
84 | requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
85 | setContentView(R.layout.main);
86 | getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
87 |
88 | // Set up the custom title
89 | titleApp = (TextView) findViewById(R.id.title_left_text);
90 | titleApp.setText(R.string.app_name);
91 | titleApp = (TextView) findViewById(R.id.title_right_text);
92 |
93 |
94 | // Get local Bluetooth adapter
95 | bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
96 |
97 | // If the adapter is null, then Bluetooth is not supported
98 | if (bluetoothAdapter == null) {
99 | Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
100 | finish();
101 | return;
102 | }
103 |
104 |
105 | }
106 |
107 | @Override
108 | public void onStart() {
109 | super.onStart();
110 |
111 | if (!bluetoothAdapter.isEnabled()) {
112 | Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
113 | startActivityForResult(enableIntent, REQUEST_ENABLE_BT);
114 | // Otherwise, setup the chat session
115 | } else {
116 | if (tunerService == null) setupTuner();
117 | }
118 | }
119 |
120 | @Override
121 | public synchronized void onResume() {
122 | super.onResume();
123 |
124 | // Performing this check in onResume() covers the case in which BT was
125 | // not enabled during onStart(), so we were paused to enable it...
126 | // onResume() will be called when ACTION_REQUEST_ENABLE activity returns.
127 | if (tunerService != null) {
128 | // Only if the state is STATE_NONE, do we know that we haven't started already
129 | if (tunerService.getState() == BluetoothService.STATE_NONE) {
130 | // Start the Bluetooth services
131 | tunerService.start();
132 | }
133 | }
134 | }
135 |
136 | private void setupTuner() {
137 | tunerService = new BluetoothService(this, mHandler);
138 |
139 | }
140 |
141 | @Override
142 | public void onDestroy() {
143 | super.onDestroy();
144 | // Stop the Bluetooth chat services
145 | if (tunerService != null) tunerService.stop();
146 |
147 | }
148 |
149 | private void ensureDiscoverable() {
150 |
151 | if (bluetoothAdapter.getScanMode() !=
152 | BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
153 | Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
154 | discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300);
155 | startActivity(discoverableIntent);
156 | }
157 | }
158 |
159 | /**
160 | * Sends a message.
161 | * @param message A string of text to send.
162 | */
163 | private void sendMessage(String message) {
164 | // Check that we're actually connected before trying anything
165 | if (tunerService.getState() != BluetoothService.STATE_CONNECTED) {
166 | Toast.makeText(this, R.string.not_connected, Toast.LENGTH_SHORT).show();
167 | return;
168 | }
169 |
170 | // Check that there's actually something to send
171 | if (message.length() > 0) {
172 | // Get the message bytes and tell the BluetoothChatService to write
173 | byte[] send = message.getBytes();
174 | tunerService.write(send);
175 |
176 | // Reset out string buffer to zero and clear the edit text field
177 | // -- mOutStringBuffer.setLength(0);
178 | // -- mOutEditText.setText(mOutStringBuffer);
179 | }
180 | }
181 |
182 | // The Handler that gets information back from the BluetoothChatService
183 | private final Handler mHandler = new Handler() {
184 | @Override
185 | public void handleMessage(Message msg) {
186 | switch (msg.what) {
187 | case MESSAGE_STATE_CHANGE:
188 | switch (msg.arg1) {
189 | case BluetoothService.STATE_CONNECTED:
190 | titleApp.setText(R.string.title_connected_to);
191 | titleApp.append(connectedDeviceName);
192 | // -- mConversationArrayAdapter.clear();
193 | break;
194 | case BluetoothService.STATE_CONNECTING:
195 | titleApp.setText(R.string.title_connecting);
196 | break;
197 | case BluetoothService.STATE_LISTEN:
198 | case BluetoothService.STATE_NONE:
199 | titleApp.setText(R.string.title_not_connected);
200 | break;
201 | }
202 | break;
203 | case MESSAGE_DEVICE_NAME:
204 | // save the connected device's name
205 | connectedDeviceName = msg.getData().getString(DEVICE_NAME);
206 | Toast.makeText(getApplicationContext(), "Connected to "
207 | + connectedDeviceName, Toast.LENGTH_SHORT).show();
208 | break;
209 | case MESSAGE_TOAST:
210 | Toast.makeText(getApplicationContext(), msg.getData().getString(TOAST),
211 | Toast.LENGTH_SHORT).show();
212 | break;
213 | }
214 | }
215 | };
216 |
217 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
218 |
219 | switch (requestCode) {
220 | case REQUEST_CONNECT_DEVICE:
221 | // When DeviceListActivity returns with a device to connect
222 | if (resultCode == Activity.RESULT_OK) {
223 | // Get the device MAC address
224 | String address = data.getExtras()
225 | .getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS);
226 | // Get the BLuetoothDevice object
227 | BluetoothDevice device = bluetoothAdapter.getRemoteDevice(address);
228 | // Attempt to connect to the device
229 | tunerService.connect(device);
230 | }
231 | break;
232 | case REQUEST_ENABLE_BT:
233 | // When the request to enable Bluetooth returns
234 | if (resultCode == Activity.RESULT_OK) {
235 | // Bluetooth is now enabled, so set up a chat session
236 | setupTuner();
237 | } else {
238 | // User did not enable Bluetooth or an error occured
239 | Toast.makeText(this, R.string.bt_not_enabled_leaving, Toast.LENGTH_SHORT).show();
240 | finish();
241 | }
242 | }
243 | }
244 |
245 | @Override
246 | public boolean onCreateOptionsMenu(Menu menu) {
247 | MenuInflater inflater = getMenuInflater();
248 | inflater.inflate(R.menu.option_menu, menu);
249 | return true;
250 | }
251 |
252 | @Override
253 | public boolean onOptionsItemSelected(MenuItem item) {
254 | switch (item.getItemId()) {
255 | case R.id.scan:
256 | // Launch the DeviceListActivity to see devices and do scan
257 | Intent serverIntent = new Intent(this, DeviceListActivity.class);
258 | startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE);
259 | return true;
260 | case R.id.discoverable:
261 | // Ensure this device is discoverable by others
262 | ensureDiscoverable();
263 | return true;
264 | }
265 | return false;
266 | }
267 |
268 | public void handleLeftTuning (View v) {
269 | sendMessage("l");
270 |
271 | }
272 |
273 | public void handleRightTuning (View v) {
274 | sendMessage("r");
275 |
276 | }
277 |
278 | public void handlefastLeftTuning (View v) {
279 | sendMessage("L");
280 | }
281 |
282 | public void handlefastRightTuning (View v) {
283 | sendMessage("R");
284 | }
285 |
286 |
287 | public void handleMaxTuning (View v) {
288 | sendMessage("M");
289 | }
290 |
291 |
292 | public void handleMinTuning (View v) {
293 | sendMessage("m");
294 | }
295 |
296 | public void handleCenterTuning (View v) {
297 | sendMessage("C");
298 | }
299 |
300 | public void handlePlusTuning (View v) {
301 | sendMessage("+");
302 | }
303 |
304 | public void handleMinusTuning (View v) {
305 | sendMessage("-");
306 | }
307 |
308 | public void handleScanTuning30 (View v) {
309 | sendMessage("S");
310 | }
311 |
312 | public void handleScanTuning20 (View v) {
313 | sendMessage("s");
314 | }
315 |
316 |
317 | }
--------------------------------------------------------------------------------
/AndroidDevice/src/br/eti/caratti/AntennaTuner/DeviceListActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package br.eti.caratti.AntennaTuner;
18 |
19 | import java.util.Set;
20 |
21 | import android.app.Activity;
22 | import android.bluetooth.BluetoothAdapter;
23 | import android.bluetooth.BluetoothDevice;
24 | import android.content.BroadcastReceiver;
25 | import android.content.Context;
26 | import android.content.Intent;
27 | import android.content.IntentFilter;
28 | import android.os.Bundle;
29 | import android.util.Log;
30 | import android.view.View;
31 | import android.view.Window;
32 | import android.view.View.OnClickListener;
33 | import android.widget.AdapterView;
34 | import android.widget.ArrayAdapter;
35 | import android.widget.Button;
36 | import android.widget.ListView;
37 | import android.widget.TextView;
38 | import android.widget.AdapterView.OnItemClickListener;
39 |
40 | /**
41 | * This Activity appears as a dialog. It lists any paired devices and
42 | * devices detected in the area after discovery. When a device is chosen
43 | * by the user, the MAC address of the device is sent back to the parent
44 | * Activity in the result Intent.
45 | */
46 | public class DeviceListActivity extends Activity {
47 | // Debugging
48 | private static final String TAG = "DeviceListActivity";
49 | private static final boolean D = true;
50 |
51 | // Return Intent extra
52 | public static String EXTRA_DEVICE_ADDRESS = "device_address";
53 |
54 | // Member fields
55 | private BluetoothAdapter mBtAdapter;
56 | private ArrayAdapter mPairedDevicesArrayAdapter;
57 | private ArrayAdapter mNewDevicesArrayAdapter;
58 |
59 | @Override
60 | protected void onCreate(Bundle savedInstanceState) {
61 | super.onCreate(savedInstanceState);
62 |
63 | // Setup the window
64 | requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
65 | setContentView(R.layout.device_list);
66 |
67 | // Set result CANCELED incase the user backs out
68 | setResult(Activity.RESULT_CANCELED);
69 |
70 | // Initialize the button to perform device discovery
71 | Button scanButton = (Button) findViewById(R.id.button_scan);
72 | scanButton.setOnClickListener(new OnClickListener() {
73 | public void onClick(View v) {
74 | doDiscovery();
75 | v.setVisibility(View.GONE);
76 | }
77 | });
78 |
79 | // Initialize array adapters. One for already paired devices and
80 | // one for newly discovered devices
81 | mPairedDevicesArrayAdapter = new ArrayAdapter(this, R.layout.device_name);
82 | mNewDevicesArrayAdapter = new ArrayAdapter(this, R.layout.device_name);
83 |
84 | // Find and set up the ListView for paired devices
85 | ListView pairedListView = (ListView) findViewById(R.id.paired_devices);
86 | pairedListView.setAdapter(mPairedDevicesArrayAdapter);
87 | pairedListView.setOnItemClickListener(mDeviceClickListener);
88 |
89 | // Find and set up the ListView for newly discovered devices
90 | ListView newDevicesListView = (ListView) findViewById(R.id.new_devices);
91 | newDevicesListView.setAdapter(mNewDevicesArrayAdapter);
92 | newDevicesListView.setOnItemClickListener(mDeviceClickListener);
93 |
94 | // Register for broadcasts when a device is discovered
95 | IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
96 | this.registerReceiver(mReceiver, filter);
97 |
98 | // Register for broadcasts when discovery has finished
99 | filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
100 | this.registerReceiver(mReceiver, filter);
101 |
102 | // Get the local Bluetooth adapter
103 | mBtAdapter = BluetoothAdapter.getDefaultAdapter();
104 |
105 | // Get a set of currently paired devices
106 | Set pairedDevices = mBtAdapter.getBondedDevices();
107 |
108 | // If there are paired devices, add each one to the ArrayAdapter
109 | if (pairedDevices.size() > 0) {
110 | findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE);
111 | for (BluetoothDevice device : pairedDevices) {
112 | mPairedDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress());
113 | }
114 | } else {
115 | String noDevices = getResources().getText(R.string.none_paired).toString();
116 | mPairedDevicesArrayAdapter.add(noDevices);
117 | }
118 | }
119 |
120 | @Override
121 | protected void onDestroy() {
122 | super.onDestroy();
123 |
124 | // Make sure we're not doing discovery anymore
125 | if (mBtAdapter != null) {
126 | mBtAdapter.cancelDiscovery();
127 | }
128 |
129 | // Unregister broadcast listeners
130 | this.unregisterReceiver(mReceiver);
131 | }
132 |
133 | /**
134 | * Start device discover with the BluetoothAdapter
135 | */
136 | private void doDiscovery() {
137 | if (D) Log.d(TAG, "doDiscovery()");
138 |
139 | // Indicate scanning in the title
140 | setProgressBarIndeterminateVisibility(true);
141 | setTitle(R.string.scanning);
142 |
143 | // Turn on sub-title for new devices
144 | findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE);
145 |
146 | // If we're already discovering, stop it
147 | if (mBtAdapter.isDiscovering()) {
148 | mBtAdapter.cancelDiscovery();
149 | }
150 |
151 | // Request discover from BluetoothAdapter
152 | mBtAdapter.startDiscovery();
153 | }
154 |
155 | // The on-click listener for all devices in the ListViews
156 | private OnItemClickListener mDeviceClickListener = new OnItemClickListener() {
157 | public void onItemClick(AdapterView> av, View v, int arg2, long arg3) {
158 | // Cancel discovery because it's costly and we're about to connect
159 | mBtAdapter.cancelDiscovery();
160 |
161 | // Get the device MAC address, which is the last 17 chars in the View
162 | String info = ((TextView) v).getText().toString();
163 | String address = info.substring(info.length() - 17);
164 |
165 | // Create the result Intent and include the MAC address
166 | Intent intent = new Intent();
167 | intent.putExtra(EXTRA_DEVICE_ADDRESS, address);
168 |
169 | // Set result and finish this Activity
170 | setResult(Activity.RESULT_OK, intent);
171 | finish();
172 | }
173 | };
174 |
175 | // The BroadcastReceiver that listens for discovered devices and
176 | // changes the title when discovery is finished
177 | private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
178 | @Override
179 | public void onReceive(Context context, Intent intent) {
180 | String action = intent.getAction();
181 |
182 | // When discovery finds a device
183 | if (BluetoothDevice.ACTION_FOUND.equals(action)) {
184 | // Get the BluetoothDevice object from the Intent
185 | BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
186 | // If it's already paired, skip it, because it's been listed already
187 | if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
188 | mNewDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress());
189 | }
190 | // When discovery is finished, change the Activity title
191 | } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
192 | setProgressBarIndeterminateVisibility(false);
193 | setTitle(R.string.select_device);
194 | if (mNewDevicesArrayAdapter.getCount() == 0) {
195 | String noDevices = getResources().getText(R.string.none_found).toString();
196 | mNewDevicesArrayAdapter.add(noDevices);
197 | }
198 | }
199 | }
200 | };
201 |
202 | }
203 |
--------------------------------------------------------------------------------
/Arduino/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/Arduino/.DS_Store
--------------------------------------------------------------------------------
/Arduino/controle_antena_android_mini_motor.ino:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | *
4 | * Mini Stepper Motor Controlled by Android and Arduino via Bluetooth
5 | * Author: Ricardo Lima Caratti - PU2CLR.
6 | *
7 | */
8 |
9 |
10 | #include
11 |
12 | #define REV 250
13 | #define FAST_SPEED 120
14 | #define MEDIUM_SPEED 90
15 | #define SLOW_SPEED 50
16 |
17 | Stepper capacitor(REV, 8,9,10,11);
18 |
19 | void setup() {
20 | Serial.begin(9600);
21 | capacitor.setSpeed(MEDIUM_SPEED);
22 | doSleep();
23 | }
24 |
25 | void doSleep() {
26 |
27 | digitalWrite(8,LOW);
28 | digitalWrite(9,LOW);
29 | digitalWrite(10,LOW);
30 | digitalWrite(11,LOW);
31 |
32 | }
33 |
34 | /*
35 | ** Looking for the best condition
36 | ** Obs: To be implemented
37 | */
38 | void scan() {
39 |
40 | int i;
41 | char c;
42 |
43 | capacitor.setSpeed(FAST_SPEED);
44 | capacitor.step(-100);
45 | capacitor.step(200);
46 | capacitor.step(-250);
47 | capacitor.setSpeed(SLOW_SPEED);
48 |
49 | for(i = 0; i < 250; i++ ) {
50 | capacitor.step(1);
51 | // TO DO
52 | if (Serial.available()) {
53 | c = Serial.read();
54 | if ( c == 'C' || c == 'c' ) { // Cancel if something is sent.
55 | capacitor.setSpeed(MEDIUM_SPEED);
56 | return;
57 | }
58 | }
59 | delay(50);
60 | }
61 |
62 | capacitor.setSpeed(MEDIUM_SPEED);
63 | capacitor.step(-100);
64 |
65 | doSleep();
66 |
67 | }
68 |
69 | void loop() {
70 |
71 |
72 | // read string from buffer (Bluetooth)
73 | if (Serial.available()) {
74 |
75 | switch ( Serial.read() ) {
76 | case '+':
77 | case '=':
78 | capacitor.step(1);
79 | break;
80 | case '-':
81 | capacitor.step(-1);
82 | break;
83 | case 'l':
84 | capacitor.step(-20);
85 | break;
86 | case 'r':
87 | capacitor.step(20);
88 | break;
89 | case 'L':
90 | capacitor.step(-100);
91 | break;
92 | case 'R':
93 | capacitor.step(100);;
94 | break;
95 | case 'S':
96 | case 's':
97 | scan();
98 | break;
99 | default:
100 | doSleep();
101 | break;
102 | }
103 |
104 | }
105 | }
106 |
107 |
--------------------------------------------------------------------------------
/Desenvolvimento de Hardware e Software para controlar uma Antena Loop remotamente por meio de um dispositivo Android.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/Desenvolvimento de Hardware e Software para controlar uma Antena Loop remotamente por meio de um dispositivo Android.docx
--------------------------------------------------------------------------------
/Mini_stepper_motor.fzz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/Mini_stepper_motor.fzz
--------------------------------------------------------------------------------
/Mini_stepper_motor_schematic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pu2clr/Mini-Stepper-Motor-with-Android-and-Arduino/6a952889f7a63e09f35f74e459c3f6f463d91d3a/Mini_stepper_motor_schematic.jpg
--------------------------------------------------------------------------------
/README.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | References:
4 |
5 | DRIVING STEPPER MOTORS WITH THE L293D:
6 | http://www.seattlerobotics.org/encoder/may98/steppers.html
7 |
8 | Stepper Motor interfacing with Microcontrollers:
9 | http://www.8051projects.net/stepper-motor-interfacing/stepper-motor-connections.php
10 |
11 |
12 |
13 | Schematic:
14 |
15 | See: Mini_stepper_motor_schematic.jpg
16 |
17 |
18 | Programming:
19 |
20 | AndroidDevice folder: It is the Android app remote control implementation. You can use Eclipse IDE to modify it. This version works with Android 4 and above.
21 |
22 | Arduino folder: It is the Arduino sketch implementation. You can use the Arduino IDE to modify it.
23 |
24 |
25 | By
26 | Ricardo Lima Caratti
27 | PU2CLR.
28 |
--------------------------------------------------------------------------------