当前位置:   article > 正文

arduino安卓手机版_【教程】Android手机通过OTG线连接Arduino,读写串口数据

手机otg连接arduion单片机

/*

* Copyright (C) 2012 Mathias Jeppsson

*

* Licensed under the Apache License, Version 2.0 (the "License");

* you may not use this file except in compliance with the License.

* You may obtain a copy of the License at

*

*      [url]http://www.apache.org/licenses/LICENSE-2.0[/url]

*

* Unless required by applicable law or agreed to in writing, software

* distributed under the License is distributed on an "AS IS" BASIS,

* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* See the License for the specific language governing permissions and

* limitations under the License.

*/

package com.primavera.arduino.listener;

import android.app.Service;

import android.content.BroadcastReceiver;

import android.content.Context;

import android.content.Intent;

import android.content.IntentFilter;

import android.hardware.usb.UsbConstants;

import android.hardware.usb.UsbDevice;

import android.hardware.usb.UsbDeviceConnection;

import android.hardware.usb.UsbEndpoint;

import android.hardware.usb.UsbInterface;

import android.hardware.usb.UsbManager;

import android.os.Handler;

import android.os.IBinder;

import android.os.Looper;

import android.os.Message;

import android.util.Log;

import android.widget.Toast;

public class ArduinoCommunicatorService extends Service {

private final static String TAG = "ArduinoCommunicatorService";

private final static boolean DEBUG = false;

private boolean mIsRunning = false;

private SenderThread mSenderThread;

private volatile UsbDevice mUsbDevice = null;

private volatile UsbDeviceConnection mUsbConnection = null;

private volatile UsbEndpoint mInUsbEndpoint = null;

private volatile UsbEndpoint mOutUsbEndpoint = null;

final static String DATA_RECEIVED_INTENT = "primavera.arduino

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/211525
推荐阅读
相关标签
  

闽ICP备14008679号