• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!


How-to use a serial port with Android, Liquidware Ambrosia edition

This version was saved 12 years, 5 months ago View current version     Page history
Saved by Will
on June 29, 2011 at 4:07:23 pm

This tutorial will help you transmit and recieve to a serial device using your Liquidware Android kit and Ambrosia Card

This could be useful to interface Android applications to serial devices like Arduinos, Accelerometers, and other sensors.



  • In your Skeleton app add this code to begin serial:
import android.serial.*;
SerialManager Serial; 

Serial = (SerialManager) getSystemService(Context.SERIAL_SERVICE); 


  • In your Skeleton app add this code to receive serial:
/* Handle Serial messages */
 SerialStatus.SerialMsgListener sl = new SerialStatus.SerialMsgListener() {
 public void onSerialMsgReceived(String sMsg) {
  /* Handle the message.. */ 
  Log.v("SkeletonSerial", sMsg);


  • Add this code to begin serial
Serial.begin("ttyUSB0", 9600);


  • In your skeleton app add this code to transmit serial: 


  • Add this code to end serial


  • Upload your code
    • [Screenshot]


  • Plug in your Serial device.  I am using an Arduino.



  • On the Arduino I used this sketch which will blink an LED when I send a "U":
void setup(){

int i=0;

void loop() {
  if (Serial.available()) {
    int msg = Serial.read();
    if (msg == 'A') {
      digitalWrite(13, HIGH);
      Serial.println("Turning LED on..");
    if (msg == 'B') {
      digitalWrite(13, LOW);
      Serial.println("Turning LED off..");




Comments (0)

You don't have permission to comment on this page.