教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 文库大全 > 专业资料 >

单片机与接口技术课外制作-Android蓝牙遥控小车编程参考

来源:网络收集 时间:2026-09-11
导读: 《单片机与接口技术》课外制作(课程设计)编程参考(1) Android蓝牙遥控程序设计 邹立杰 广州大学华软软件学院 软件工程系 2014.5.22 1. Configuration the Development Environment: (1) Download and install/configuration Java SDK SE You can seek

《单片机与接口技术》课外制作(课程设计)编程参考(1)

Android蓝牙遥控程序设计

邹立杰

广州大学华软软件学院 软件工程系

2014.5.22

1. Configuration the Development Environment:

(1) Download and install/configuration Java SDK SE

You can seek methods from internet .specially,you need configuration the system environment variable “path”. (2) Download and Install Android Development IDE

Download the package:

adt-bundle-windows-x86_64-20140321.zip from the URL:

/sdk/index.html

download web page:

(3) Unpackaged the package

adt-bundle-windows-x86_64-20140321.zip to a directory on your hard disk.

Ok, your android development environment is ok!

2. Ctreate a Virtual Device for Your Android Application:

(1) start eclipse application by double click the

executable file:

The application window:

Select the menu item as below:

The appear the AVD manager dialog:

Click the “New”button:

Fill the AVD name as you like name; Select a device; Select a Target; Select a CPU/ABI; Select a skin;

Any default item you can select. The reference select as below:

When the below dialog appeared ,youe AVD is created ok.

Start the AVD:

Don’t close the AVD , Keep the AVD alived !

3. Design Your Car Blue-teeth Remote Program

(1)

Create an Android Application Project:

Fill the dialog items:

the click the “Next” button

Click the “Next” Button:

Click the “Next” button

And continue to click the “Next” button:

Click “Finish” button,your android application project is created!

Project Files Struchure:

(2)

Modify the AndroidManifest.xml file:

<manifest xmlns:android="/apk/res/android" package="com.example.blue" android:versionCode="1"

android:versionName="1.0" > <uses-sdk

android:minSdkVersion="8"

android:targetSdkVersion="15" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <application

android:icon="@drawable/ic_launcher" android:label="@string/app_name"

android:theme="@style/AppTheme" > <activity

android:name=".MainActivity"

android:label="@string/title_activity_main" > <intent-filter>

<action android:name="android.intent.action.MAIN" />

<category android:name="UNCHER" /> </intent-filter> </activity> </application> </manifest>

Add 2 sentences to the AndroidManifest.xml file.

(3)

Modify the layout file activity_main.xml

<?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout

android:id="@+id/widget0"

android:layout_width="fill_parent" android:layout_height="fill_parent"

xmlns:android="/apk/res/android" android:background="@drawable/sise" >

<Button

android:id="@+id/btnF"

android:layout_width="88dp"

android:layout_height="wrap_content" android:layout_x="124dp" android:layout_y="58dp" android:text="向前" />

<Button

android:id="@+id/btnS"

android:layout_width="88dp"

android:layout_height="wrap_content" android:layout_x="124dp" android:layout_y="140dp" android:text="停止" /> <Button

android:id="@+id/btnB"

android:layout_width="88dp"

android:layout_height="wrap_content" android:layout_x="124dp" android:layout_y="222dp" android:text="后退" /> <Button

android:id="@+id/btnR"

android:layout_width="88dp"

android:layout_height="wrap_content" android:layout_x="227dp" android:layout_y="140dp" android:text="右转" /> <Button

android:id="@+id/btnL"

android:layout_width="88dp"

android:layout_height="wrap_content" android:layout_x="23dp" android:layout_y="140dp" android:text="左转" /> </AbsoluteLayout>

(4) Modify the resurce file strings.xml

<resources>

<string name="app_name">蓝牙小车遥控-华软学院</string> <string name="hello_world">Hello world!</string> <string name="menu_settings">Settings</string>

<string name="title_activity_main">蓝牙小车遥控-华软学院</string> </resources>

(5) Modify the Main Activity file MainActivity.java

package com.example.blue;

import android.os.Bundle; import android.app.Activity; import android.view.Menu; import java.io.IOException; import java.io.OutputStream; import java.util.UUID;

import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.view.Gravity;

import android.view.MotionEvent; import android.view.View;

import android.widget.Button; import android.widget.Toast; import com.example.blue.R;

public class MainActivity extends Activity {

…… 此处隐藏:3885字,全部文档内容请下载后查看。喜欢就下载吧 ……

单片机与接口技术课外制作-Android蓝牙遥控小车编程参考.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wenku/265705.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)