通过单片机连接的蓝牙模块发送数据,手机也是通过蓝牙接收,并在屏幕上完成绘画。
import android.widget.Button;
import android.widget.TextView;
public class Oscilloscope extends Activity {
/** Called when the activity is first created. */
final int HEIGHT=320; //设置画图范围高度
final int WIDTH=450; //画图范围宽度
final int X_OFFSET = 5; //x轴(原点)起始位置偏移画图范围一点
private int cx = X_OFFSET; //实时x的坐标
int centerY = HEIGHT /2; //y轴的位置
TextView myview = null; //画布下方显示获取数据的地方
final UUID uuid =
UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
//uuid 此为单片机蓝牙模块用
//还有其他的uuid,这个可以再百度查到,暂不清楚其中的差别
final BluetoothAdapter mBluetoothAdapter =
BluetoothAdapter.getDefaultAdapter();
//获取本手机的蓝牙适配器
static int REQUEST_ENABLE_BT = 1; // 一个常量而已,开启蓝牙时使用
BluetoothSocket socket = null; //用于数据传输的socket
int READ = 1; //一个常量,用于传输数据消息队列的
搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新高等教育android 蓝牙 单片机 显示波形(7)全文阅读和word下载服务。
相关推荐: