I've been working on a project where i want to send a set of variables from an Arduino to an Android device, and have found this code for receiving the data on the Android:
I'm trying to show the data on the screen of the phone, but nothing shows up, so something is obviously wrong...
textAlign(CENTER, TOP);
text(
"temp: " + (sensorValueTemp) + "\n" +
"trykk1: " + (sensorValueTrykk1) + "\n" +
"trykk2: " + (sensorValueTrykk2) + "\n" +
"trykk3: " + (sensorValueTrykk3) + "\n" +
"cps: " + (sensorValueCPS), 160, 180);
All of my variables' values should be within the range from 0 to 255, and I've tried to Serial.print them and they show up perfectly there. Have anybody tried something similar before, or see something wrong in the code?
We have a school project where we want to build a CanSat using some of the sensors found on an Android device, such as accelerometer data and GPS-coordinates, together with some on an Arduino board (pressure, temperature and a geiger counter). We bought the Sony Tipo ST21i and Arduino Mega ADK, and learned that the Tipo only supports ADB mode.
We don't have much programming experience, but found many great tutorials online and source codes from other projects which we tried to merge together. Unfortunately the USB communication between the Tipo and the Arduino doesn't work in this code. We don't know wether the problem lies on the Android or the Arduino side, but here are both codes:
(Android code is to collect accelerometer data and GPS coordinates and send them using ADB)
public final byte COMMAND_SEND_TRUE = 1; // Allow data transfer