For my on-hand HC-05 sample, it set as slave role and 9600, 0, 0, PIN="1234" by default. So it can be used in this example without any extra setting.
Connection between UNO and HC-05
HC-05 Rx - Uno Tx (1)
HC-05 Tx - Uno Rx (0)
HC-05 GND - Uno GND
HC-05 VCC - Uno 5V (My HC-05 marked "Power: 3.6V-6V", refer here, make sure your HC-05 can work on 5V.)
Uno_Serial_echo.ino
/*
Arduino Uno + HC-05 (Bluetooth) - echo bluetooth data
Serial (Tx/Rx) communicate to HC-05
HC-05 Rx - Uno Tx (1)
HC-05 Tx - Uno Rx (0)
HC-05 GND - Uno GND
HC-05 VCC - Uno 5V
*/
void setup()
{
delay(1000);
Serial.begin(9600);
}
void loop()
{
while(Serial.available())
{
char data = Serial.read();
Serial.write(data);
}
}
This video show how Android BluetoothChat example link with Arduino UNO + HC-05. For the Android BluetoothChat example, refer last post.
We need a FTDI USB-to-Serial adapter to connect PC/USB and HC-05 Bluetooth, and use Arduino IDE's Serial Monitor as terminal, to talk with Android running modified BluetoothChat example.
This video show how to import BluetoothChat example in Android Studio, and edit BluetoothChatService.java to change MY_UUID_SECURE to UUID.fromString("00001101-0000-1000-8000-00805F9B34FB").
It's a example to implement communication between Android and Arduino Uno. Here Android is running in USB Host Mode. String received in Arduino Uno is displayed on 2x16 LCD Module.
Beginning NFC with PhoneGap and Arduino - O'Reilly Webcast
Originally recorded April 29, 2014. Don Coleman, Tom Igoe, and Brian Jepson (authors of Beginning NFC ) will introduce you to Near Field Communication using Android phones, Arduino, and NFC readers for computers and Arduino. Learn how information on NFC tags is stored and retrieved, how to write applications on Arduino and Android to read and write tags, and how to integrate NFC into larger projects.
Two demos in this session will feature :
Reading a tag with an Android PhoneGap application
Writing to a tag from Arduino
And when both are done, we'll be able to show you how an Android device can read the tag you wrote from Arduino and take an action based on the data you stored.
This is a example in my another blog show how Android send command to Arduino in USB Host mode. When user toggle the LED by clicking on the button, or change the screen color by slideing the bars, the commands will be add in a command queue, and then send to Arduino in background.
- Make sure Android 2.3.3 (API 10) and associated Google APIs are installed in your Android Developer Tools. In Eclipse, select Window in menu bar, -> Android SDK Manager.
Import downloaded ArduinoTerminalSrc:
- Click File -> Import...
- Select "Existing Android Code into Workspace" under Android section.
- Browse to select downloaded and unziped folder.
- Optionally check "Copy projects into workspace" and click Finish.
- After a moment of auto-build, many error of something like "The import com.android.future cannot be resolved" will be reported.
- Right click your project - > Properties.
- Select Target Google APIs of Platform 2.3.3, and click OK.
- After finished and re-built, you can download it to your Android device. It can work with the modified ADKTerminalTest.
remark:
- Tested on Nexus One with Android 2.3.6. But not work on HTC One X with Android 4.1.1, dur to issues of Theme!
Once I switch out and back the app, and perform onResume()... The app can get fileDescriptor, myAdkInputStream and myAdkOutputStream. But when it try to write to myAdkOutputStream in WriteAdk(String text) method, IOException of "write failed: ENODEV (No such device)" thrown!
Processing is an open source programming language and environment for people who want to create images, animations, and interactions. Initially developed to serve as a software sketchbook and to teach fundamentals of computer programming within a visual context, Processing also has evolved into a tool for generating finished professional work. Today, there are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning, prototyping, and production.
Free to download and open source
Interactive programs using 2D, 3D or PDF output
OpenGL integration for accelerated 3D
For GNU/Linux, Mac OS X, and Windows
Projects run online or as double-clickable applications
Over 100 libraries extend the software into sound, video, computer vision, and more...
Well documented, with many books available
Processing for Android project is aim to make it foolishly easy to create Android apps using the Processing API. Once you have Processing on your machine (and the Android developer tools), you can simply write a line of code, hit Run (Ctrl-R or Cmd-R), and have your sketch show up in the emulator as a working Android app. Select Run on Device (Ctrl-Shift-R or Cmd-Shift-R) to have it run on an Android device that you have plugged into your machine. That's good stuff!
It's the coding in Android side to send command to Arduino Due to control LED On/Off.
Modify AndroidManifest.xml to add <uses-feature> of "android.hardware.usb.accessory", <intent-filter> of "android.hardware.usb.action.USB_ACCESSORY_ATTACHED", and <meta-data> of resource="@xml/myfilter".
Create a abstract class AbstractAdkActivity.java to extend Activity, implement the function of ADK; such that we can easy re-use it in furture and reduce the ADK related job in MainActivity.java.
Modify MainActivity.java to extend AbstractAdkActivity, and extend Activity in-turn. With AbstractAdkActivity handle most of the ADK related job, we only have to override the methods doOnCreate()(called in onCreate() method) and doAdkRead()(called after command read from ADK). To send command to ADK, call WriteAdk() method.
Learn how to control your home or car from your Android smartphone - air conditioning, lights, entertainment systems, and more!
Android Open Accessory is a new, simple, and secure protocol for connecting any microcontroller-empowered device to an Android smartphone or tablet. This Wrox guide shows Android programmers how to use AOA with Arduino, the microcontroller platform, to control such systems as lighting, air conditioning, and entertainment systems from Android devices. Furthermore, it teaches the circuit-building skills needed to create games and practical products that also take advantage of Android technology.
Introduces Android Open Accessory and shows how to set up the hardware and development environment
Explains how to code both Android and Arduino elements of an accessory
Features four complete projects developers can build using various sensors and indicators/actuators, including source code
Gives Android developers the tools to create powerful, sophisticated projects
Professional Android Open Accessory with Android ADK and Arduino opens exciting new opportunities for Android developers.
Android Open Accessory support allows external USB hardware (an Android USB accessory) to interact with an Android-powered device in a special accessory mode. When an Android-powered powered device is in accessory mode, the connected accessory acts as the USB host (powers the bus and enumerates devices) and the Android-powered device acts in the USB accessory role. Android USB accessories are specifically designed to attach to Android-powered devices and adhere to the Android Open Accessory Protocol, that allows them to detect Android-powered devices that support accessory mode. Accessories must also provide 500mA at 5V for charging power. Many previously released Android-powered devices are only capable of acting as a USB device and cannot initiate connections with external USB devices. Android Open Accessory support overcomes this limitation and allows you to build accessories that can interact with an assortment of Android-powered devices by allowing the accessory to initiate the connection.
Note: Accessory mode is ultimately dependent on the device's hardware and not all devices support accessory mode. Devices that support accessory mode can be filtered using a element in your corresponding application's Android manifest. For more information, see the USB Accessory developer guide.
Android Open Accessory support is included in Android 3.1 (API Level 12) and higher, and supported through an Add-On Library in Android 2.3.4 (API Level 10) and higher.