18 March 2013

Bluetooth Android Processing 1


PART ONE


Introduction
This is a four part tutorial which will take you through step-by-step on how to create Android apps on your Mobile device that will allow you to communicate with your Arduino over Bluetooth. This tutorial is based upon the Windows environment and an Android device like the Samsung Galaxy S2 Phone.
I will take you through setting up your computer and phone, and will move through in stages so that you understand what each part of the bluetooth code is actually doing. Obviously you will need to ensure that you have a Bluetooth Shield on your Arduino to be able to walk through this tutorial with me.
If you are not interested in the step-by-step instructions, you can jump straight to the end (Part 4) which will have the complete Arduino and Android/Processing code that was used in the following video:

The Goal of this project (Video)


Setting up Processing for Android applications:
For the latest and most up to date version, please follow the instructions on this website: http://wiki.processing.org/w/Android

Step One:
Download the Android SDK from this website:
http://developer.android.com/sdk/index.html
Android SDK download link
Android SDK Download:
Make sure to select the "Use and Existing IDE" link, as per the picture below.



When you select the "Use an Existing IDE" link, it will then show you the appropriate download to use. This is what it should look like.

Select the "Download the SDK Tools for Windows" link.
Once you have downloaded the Android SDK, go ahead and install it as per the instructions below.
These instruction can also be found here.






Installing the necessary packages in the Android SDK Manager program
Make the following 3 selections:
  • Tools: Android SDK Platform-tools
  • API 10: SDK Platform
  • Extras: Google USB Driver
Then select the button on the bottom-right to install your selections.

Here is a picture of the Android SDK Manager selections:


While you may decide to download other packages,
you MUST download API 10: SDK Platform .
Do not leave this one out !!


Processing.org Download Link
Step Two: Processing Download

Download the latest Processing IDE (version 2.0 Beta 8) from this website:
http://processing.org/download/

I am using Windows 7, and have chosen to download the Windows 32 bit version as shown below.




Load Processing, and switch to Android mode, as per the image below.




You should now have an empty sketch window which looks something like this.





Step Three: Setting up the Android Hardware device (Phone)
For the latest steps you can have a look at this site:
http://developer.android.com/tools/device.html

However, these are the ones that I carried out:

Turn on USB debugging on your Android Phone:
To find out what Android Version you are on, have a look at
    Settings > About Phone : look for heading "Android Version".
  • My Android version is 2.3.4 on my Samsung Galaxy S2.
To Enable USB Debugging:
   
Settings > Applications > Development > Select (or Enable) USB debugging

For those of you who have a different Android version, have a look below:





Downloading the USB driver for your Android Phone (Windows Users)
If you are developing on Windows and would like to connect an Android-powered device to test your applications, then you need to install the appropriate USB driver. Have a look at this site for more information on how to download the USB driver for your phone:
http://developer.android.com/tools/extras/oem-usb.html

I have a Samsung Galaxy S2 phone, so I had to go to the Samsung Site here:
http://www.samsung.com/us/support/downloads

But because I am not in the USA, I had to click on the link for "non-US products":
http://www.samsung.com/us/support/downloads/global

You will need the model number of your phone:
On the Samsung Galaxy S2, you can go into
    Settings > About Phone => Model number. Otherwise, it is located behind the battery.
  • My Phone's Model Number is: GT-I9100
See the image below for the link to press if you have a non-US phone.



Then I continued with the install of the USB driver as per the document below:
http://developer.android.com/tools/extras/oem-usb.html







Step Four: Android-Processing Sketch
We will now test our our current setup and make sure that we can run a simple Processing Sketch on the Phone. Bluetooth functionality will be tested later on, so all we need for this step, is our computer, our Android phone, and a USB cable. While it is possible to run this sketch without an Android phone (by using the emulator), I personally do not have the patience to wait an eternity while the emulator boots up... (yes, it takes an eternity)... In this tutorial, we are going to test it on the device (phone).
This sketch has an orange background and a black circle which you can move around the screen with your finger (that's it) - I did say it was going to be a simple sketch.

Copy and paste the following Android-Processing sketch into the IDE, and then press the (Run on Device) button, which is the triangle button or press Ctrl-R.


Android/Processing Sketch 1: Circle Dragger
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*Circle Dragger: Simple Android-Processing Sketch written by ScottC on 13/03/2013.
Visit: http://arduinobasics.blogspot.com/
*/


int circleWidth = 150;

void setup(){
orientation(LANDSCAPE);
}

void draw(){
background(255,100,0);
fill(0);
ellipse(mouseX,mouseY,circleWidth,circleWidth);
}


You should see an orange screen appear on your phone. Move your finger across the screen and watch as the black circle follows your finger.
No, not rocket science, but hopefully everything worked as planned. If you want to change the colour of the background or circle, this is a good site:
http://www.colorpicker.com/



Step Five: Bluetooth testing:
We are now going to walk through Bluetooth connectivity. While we could just use a library to do all the heavy lifting for us, I decided to explore Bluetooth functionality from scratch. This will hopefully provide greater returns in the long run. Ok, lets create a new Android/Processing Sketch which changes its behaviour depending on whether Bluetooth is enabled or disabled when the sketch is run. We will display a red screen when Bluetooth is switched off, and green when Bluetooth is switched on.

To enable Bluetooth on my Samsung Galaxy SII phone:
  • Settings >Wireless and Network > Bluetooth Settings > Bluetooth (Turn on Bluetooth) - check the box

To disable Bluetooth on my Samsung Galaxy SII phone:
  • Settings >Wireless and Network > Bluetooth Settings > Bluetooth - Uncheck the box

In the processing/android IDE, you need to make sure that you update the AndroidManifest.xml file to grant specific permissions. You can either edit the file manually in the sketch folder, however, it is much easier and safer to do the following. In the processing/android IDE, select:
  •   Android > Sketch permissions  (as per the picture below)

  • Make sure that BLUETOOTH and BLUETOOTH_ADMIN are selected (as per the picture below). Then press the OK button.


Then copy and paste the following sketch into the processing/android IDE:


Android/Processing Sketch 2: BluetoothChecker1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*BluetoothChecker1: Written by ScottC on 17 March 2013
This will show a red screen if Bluetooth is off,
and a green screen when Bluetooth is switched on */


import android.bluetooth.BluetoothAdapter;

BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();

void setup(){
orientation(LANDSCAPE);
}

void draw(){
if(bluetooth.isEnabled()){
background(10,255,30);
}
else {
background(255,10,30);
}
}


When you run the BluetoothChecker1 sketch on the device, you will either see a red screen or a green screen depending on whether you had Bluetooth enabled or disabled at the time. Ok, pretty boring, but it is a start. What if we wanted to ask the USER if they would like to enable Bluetooth at the beginning? We could then change the appearance of the screen depending on their selected answer. Before we add this functionality, I would recommend that you read about the following concepts introduced in the next sketch.
While it is actually possible to turn bluetooth on without asking for permission, I thought I would retain my manners for the following sketch:

Android/Processing Sketch 3: BluetoothChecker2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*BluetoothChecker2: Written by ScottC on 17 March 2013

If Bluetooth is already ON when you run this sketch,
the background will display BLUE.

If Bluetooth is OFF when you run this sketch but you
agree to turn it on, the background will display GREEN.

If Bluetooth is OFF when you run this sketch and then
choose to keep it off, the background will display RED.

=======================================================*/


import android.bluetooth.BluetoothAdapter;
import android.content.Intent;

int BACKGND=0; //Set the background to BLUE

//Get the default Bluetooth adapter
BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();


/*The startActivityForResult() launches an Activity which is
used to request the user to turn Bluetooth on.
The following onActivityResult() method is called when the
Activity exits. */

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if(requestCode==0){
if(resultCode == RESULT_OK){
BACKGND=2;
//Set the background to GREEN
}
else {
BACKGND=1;
//Set the background to RED
}
}
}

void setup(){
orientation(LANDSCAPE);

/*IF Bluetooth is NOT enabled,
then ask user permission to enable it */

if (!bluetooth.isEnabled()) {
Intent requestBluetooth =
new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(requestBluetooth, 0);
}
}

void draw(){
if(BACKGND==0){
background(10,10,255);
//Set background to BLUE
}
else if(BACKGND==1) {
background(255,10,10);
//Set background to RED
}
else {
background(10,255,10);
//Set background to GREEN
}
}

I tried my best to explain the code via the comments within. I hope it made sense.


Useful Links:

Android Processing Wiki: http://wiki.processing.org/w/Android

Here is a good tutorial which helped me put Processing and Android together:
http://www.creativeapplications.net/android/mobile-app-development-processing-android-tutorial/

And most importantly:
The Android Developers site : Bluetooth



Click here for PART TWO

Click here for PART THREE

Click here for PART FOUR

 
 



If you like this page, please do me a favour and show your appreciation :

 
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
Have a look at my videos on my YouTube channel.


 
 

 
 
 



However, if you do not have a google profile...
Feel free to share this page with your friends in any way you see fit.

65 comments:

  1. very nice

    cheers from india

    ReplyDelete
  2. Hello. Thanks for the tutorial. However I am facing a severe problem. After installing the Android SDK, Processing , Java SDK and all that is necessary, I copied your code and ran the sketch.

    The problem is that the sketch can't seem to open the emulator. No AVD device had been created for it. So I manually created one called Processing-Android-10, but I am still getting the same error.

    My sketch refuses to open in an emulator. Since I don't have an android phone, this is the only option I have. I have Android 17 and 10 APIs installed.

    I am currently using Processing 2.0b9 64 bit. Please Help!!

    ReplyDelete
    Replies
    1. Hi piyush
      Unfortunately the emulator does not have Bluetooth emulation. So this will not work. You will need to find a friend with an Android device.

      Delete
    2. Well thanks for replying. I pasted the sample code that ie generating a simple orange background. My emulator refuses to open. It shows the Trying to close ADB server and then "Connection to Device lost". Tried Google and stackoverflow for hours but still couldn't resolve it. Though you might help.

      I understand I would need an Android device to check the Bluetooth emulation but I wanted to test it out in an emulator any ways just to check if it was crashing.

      Btw the app I am making is a little different from yours. I am receiving data from the arduino instead of sending it. I am using your code as a reference. So thank you for the well detailed tutorial.

      Anyways if you could help with my problem, I would be really glad.

      Delete
    3. Hi Piyush,

      You will not be able to test out anything related to Bluetooth in the emulator - it will crash or fail to load (because Bluetooth is not supported in the emulator). You can try sketch 1 in this tutorial. Sketch 1 should work in an emulator.

      As per the Processing-Android wiki: "You can't install API 13 or 14 or 17 just because it's newer". At this stage, the processing IDE only supports version 10. Remove API 17 and see how you go.

      Scott

      Delete
    4. Sketch 1 is the one that I was trying to test the processing IDE with in the 1st place. My Android SDK has both API 17 and 10 installed.

      Delete
    5. Remove API 17 and try the most basic of sketches.
      void setup(){}
      void draw(){}
      If that doesn't work, then you have an issue with your processing IDE/API .

      Delete
    6. Hi Piyush,
      The other thing you may want to try is to use the 32 bit version of Processing. I have had some issues with the 64 bit version in the past, mainly because I use Serial quite a lot and Serial is currently not supported in the 64 bit version.

      Hope you managed to figure it out.

      Delete
  3. I have debugging enabled on my Galaxy S3 and running "adb devices" from the command line shows it is connected. However, when I select "Run on Device" processing (32 bit) loads everything up but seems to get stuck on "Installing sketch on 381e82b1." The basic circle dragger sketch never shows up on my phone. Any advice?

    ReplyDelete
    Replies
    1. Make sure not to use a later version of the ADK. Use version 10.
      Have you installed the USB driver? Other than that, am not too sure.

      Delete
    2. Thanks Scott. I do only have the API10 installed. However, I did get a bit confused by the driver install instructions. I downloaded the driver for my phone from Samsung. What is unclear is if I was supposed to install that one, the one in the sdk/extras directory, or the Samsung first and then update with the one in the sdk/extras directory. Can you clarify?

      Delete
    3. I am not sure if the order is important, however, I wrote the instructions in the order that I did it in. Most of the setup instructions can be found at the Android/Processing wiki . That site should have the most up-to-date instructions, and also provides some extra information for Mac and Linux users. I am currently using Windows 7.

      Hey Timothy, after reading back on my instructions, I can see why you got confused. I apologize, my instructions are not clear, nor are those that I followed. I am sorry.

      I am pretty sure that I installed the Samsung USB driver, and then updated it with the google USB driver.

      Delete
    4. Thanks for the clarification Scott! I will give that a shot!

      Delete
    5. Let me know how you go. I will clarify the tutorial based on your response.

      Delete
  4. Hey Scott!
    Thanks a lot for your tutorial. Was looking for something exactly like this.
    Using your code as a reference and it works like a charm.

    ReplyDelete
    Replies
    1. Thanks Krishna, I appreciate the feedback, but more importantly, I am glad it worked for you and that you got something out of it.

      Delete
  5. does this works with any version of adroid like Android v4.0.3 (for my tablet)?

    ReplyDelete
    Replies
    1. I have no idea. I have only blogged about my experience. But feel free to come back and let me know if it worked for you. As I am sure it will help others, or save them the time.

      Delete
  6. Hey scott,thanks for your tutorial
    i have a doubt when i am running the program i got following errors on console
    window like
    debug:
    Shutting down any existing adb server...
    bleh: adb devices
    status: 1
    7875ms
    stdout:

    stderr:
    error: protocol fault (no status)
    Shutting down any existing adb server...
    i am no vice about this.what should i do? please give any suggestion
    thanks in advance..

    ReplyDelete
    Replies
    1. HI Bharathi,

      I have no idea. Perhaps try posting your query on the processing forums. Someone there might be able to help ???

      I wish I could help you, but I don't know the answer to that one. I look forward to hearing back from you (when you find out what it was).

      Sorry
      Scott

      Delete
  7. thx for your sharing.. next time i will try this tutorial..

    and god bless you

    regard from indonesia :)

    ReplyDelete
  8. I was able to get sketches one and two working but 3 force closes on both phones I've tried it on.

    I got this out of processing after it crashed on my GS4:

    --------

    FATAL EXCEPTION: Animation Thread
    java.lang.SecurityException: Permission Denial: starting Intent { act=android.bluetooth.adapter.action.REQUEST_ENABLE cmp=com.android.settings/.bluetooth.RequestPermissionActivity } from ProcessRecord{43923480 14317:processing.test.sketch_130923c/u0a10227} (pid=14317, uid=10227) requires android.permission.BLUETOOTH
    at android.os.Parcel.readException(Parcel.java:1425)
    at android.os.Parcel.readException(Parcel.java:1379)
    at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2162)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1429)
    at android.app.Activity.startActivityForResult(Activity.java:3430)
    at android.app.Activity.startActivityForResult(Activity.java:3391)
    at processing.test.sketch_130923c.sketch_130923c.setup(sketch_130923c.java:66)
    at processing.core.PApplet.handleDraw(Unknown Source)
    at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source)
    at processing.core.PApplet.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:856)

    --------

    ReplyDelete
    Replies
    1. Make sure to enable Bluetooth permissions on each project

      Delete
    2. You are a gentleman and a scholar. Thank you very much.

      Delete
  9. Hi,

    I am currently running your code under step 4, and I keep getting an error stating: "error from inside the Android tools, check the console." I have downloaded the ADK tools as stated in the tutorials and selected the approprate packages as well as switched processing over to Android mode. Would you be able to help steer me in the write direction here? Your help would be greatly appreciated.

    ReplyDelete
    Replies
    1. "SDK", I should say....

      Delete
    2. "the RIGHT* direction..." my apologies for the numerous typos. It was early when I typed this.

      Delete
    3. I've got the same problem with you..hope Scott can help

      Delete
    4. Not sure. Processing has changed a bit since I wrote this tutorial. May need to try again myself to see if the process still works.
      Do you meet the system requirements?
      Have you installed JDK 6? If not, then maybe try it and see if that works.
      Otherwise - maybe try the Processing.org forums... there may be someone in there who has gone through this process themselves recently, and may be able to help you.

      Delete
  10. hi ... how can i get this code otomatic

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data){

    }

    i know if im using eclipse it's otomatic generate if im call that's function. how even in processing ?.
    should i copy paste or write manual ?

    ReplyDelete
    Replies
    1. In processing - you will need to copy and paste or write it manually. (Or a combination of both).

      Delete
  11. Thanks a lot Scott..... :)
    I will just like to add few more things, while setting up processing and SDK , to remember to check that you have JDK installed [see if you can compile any Java program,using javac]. Because otherwise, the above given codes won't compile using processing.
    Also remember while setting up SDK, not to install Android SDK Tool API:19 or higher, but instead use some lower API level. I don't know exactly why this creates a problem, but it does and by downgrading the API level things started working for me[ It may look silly , but that's what happened].

    ReplyDelete
    Replies
    1. Thanks Ankit,
      When I wrote this - only API 10 was supported by the Processing IDE.
      Not sure if this has changed to anything higher. But if in doubt, follow the instructions as provided. Thanks for highlighting these points Ankit - much appreciated

      Scott

      Delete
  12. how can i find which API is supported by processing at present

    ReplyDelete
  13. HI Scott, I tried to change the mode from Java to Android in Processing but the title bar didnt change to green color. What is the problem with that? Many thanks! Really appreciate your efforts.

    ReplyDelete
    Replies
    1. Processing has changed since I wrote this tutorial. Have not tried it since.
      But if you can see that the setting says Android as opposed to JAVA, you should be ok.

      Delete
  14. Hi Scott,
    I've selected Android in Processing and it asked me to restart Processing. When i restarted, a dialogue box is appearing saying "Is Android SDK installed?" But i've already installed the SDK. When I'm manually giving the path of the SDK to processing its saying file not found. Please help

    ReplyDelete
    Replies
    1. Some of the comments above May help you. Otherwise the processing forums will be your best bet. I will try and go through the whole process again soon and update this tutorial accordingly, but that will not happen for at least another month or so.

      Delete
  15. Great site, Thank you.
    Here is the problem I met and the resolve method
    http://doublexia.wordpress.com/2013/12/03/processing-2-1-getting-error-running-javac-exe-compiler-message-in-android-mode/
    http://stackoverflow.com/questions/12702608/processing-stuck-at-waiting-for-device-while-trying-to-connect-to-emulator

    ReplyDelete
  16. Hi Scott,

    Like everyone else i appreciate your tutorials allot especially the 433MHz RF module tutorial, at the moment i'm trying to do this tutorial but i'm getting some trouble at sketch number 4.

    The sketch runs fine when my devices bluetooth is turned off before i upload the sketch. Then after the app asks me permission to turn on bluetooth i press OK and then it just gives me a White screen unable to do anything further. It doesn't show me the discovered bluetooth devices its just a white screen.

    The other scenario i have is when my bluetooth on my device is already enabled before i upload the sketch, then the app/program just jumps straight to the white screen. So if you or someone maybe have an idea on whats going wrong or methods on debugging or modifying the sketch i would appreciate a reply.

    I have already commented out a few different bits of the code but it didn't change the outcome.
    Later on I realize it had something to do with my phones bluetooth being enable beforehand, tho the sketch only crashes after the bluetooth is enabled.


    My device is a Samsung S4 running android version 4.4.2.


    Again much much Thanks for this awesome site and tutorials keep it up.

    ReplyDelete
    Replies
    1. Hi Cm,

      Thank you for the feedback -
      You can probably tell that this tutorial is a bit dated by the phone that I used.
      I have not checked to to see if this tutorial is still current using the most recent Arduino /Processing IDEs... so take that into consideration.
      Also - in this tutorial , you will see me talking about the use of LogCat.
      I used this a lot when I first started to figure out Bluetooth. It helps to point out where your program is crashing.
      I probably should go back one day and see if I can update these tutorials... but time is always a factor for me...
      Good luck.

      Delete
  17. If you are looking for an app to communicate via Bluetooth - worth having a look at this site http://coretechrobotics.blogspot.com.au/2014/08/a-universal-bluetooth-remote-app.html

    I have not tested it myself - but it looks interesting nonetheless.

    ReplyDelete
  18. This android app fails a lot for me on the bluetooth connect. Every once in awhile it does connect though and works very well. I was looking into what the problem might be and figure it is likely because bluetooth discovery isn't cancelled before the app connects to the device.

    How would one go about doing this in the program?

    Thanks!

    ReplyDelete
    Replies
    1. Ok, well I found how to do this and I'm able to connect with much more reliability with the following change to the code in connect2Bt().

      void connect2Bt() {
      btAdapter.cancelDiscovery(); // Cancel discovery for connection reliability
      try {
      btSocket = btShield.createRfcommSocketToServiceRecord(uuid);

      Delete
    2. Now I just need to find a way to release the adapter when the program exits so that it doesn't lock up the BT adapter until it times out.

      Delete
  19. HI; Mr Scott C
    Copy the code in processing but not running gives several errors is probably because I not have installed some library required
      Consultation for Mr Scott C
      where could download these libraries such as android.bluetooth.BluetoothAdapter

    gracias por tu ayuda

    carlos

    ReplyDelete
    Replies
    1. Make sure that you are in the android section of the processing IDE.
      The import statement should work if you followed my instructions above. However, this tutorial is getting pretty old now, and it is possible that it is no longer compatible with current versions of software. If possible, try to use the software versions that I used.
      At some point I will have to come back and re-visit this tutorial and update it (if necessary)

      Delete
  20. Hiho.
    I experienced some issues using the Android mode in the Processing IDE. The Android mode did not show up when I clicked the Mode button. After some investigation I found out that the newest stable version of Processing IDE (2.2.1) is not working with modes correctly. I had to install the Pre-Release 3.0A5 version instead of the Stable 2.2.1. Hope this can be of help to people trying to get this thing to work.

    Btw. You don't need to download the Android mode from the Processing/Android github anymore. Nowdays it's built into the processing IDE (but not working in 2.2.1) so you just select it from the Mode tab.

    ReplyDelete
  21. Hi scott.
    I am having an error on onActivityResult
    also startActivityForResult function does not exist. Am i missing any libraries?

    ReplyDelete
    Replies
    1. Make sure to enable Bluetooth... The tutorial should work as described above, however, this tutorial was made ages ago - and therefore versions of IDE and SDK may no longer exist..

      You may want to have a look at this site:
      https://github.com/processing/processing-android/wiki

      Delete
  22. Scott, Will i have problems when I run this on API 22 or API 23? I cannot seem to select the API 10 on my Processing IDE even tho I have downloaded the package from SDK manager

    ReplyDelete
    Replies
    1. I am sorry Kyle - I am not sure - I have not tested it.
      I might have to remove this tutorial if it is no longer possible to get it to work.

      Delete
  23. Hey Scott ,you are right this tutorial no longer work ,i have same problem as Kyle,
    if(resultCode == RESULT_OK)
    ^^^^^^^^^
    RESULT_OK cannot be resolved to a variable

    and i could work with API 10 either ,is there any chances you could update this tutorial?

    ReplyDelete
    Replies
    1. I would love to revisit this, but I can honestly say that it will not happen for at least 6 months or longer.

      Delete
  24. Hey Scott, thanks for the tutorial. I've got it working in Processing 3. The changes needed are:

    1) change "protected void onActivityResult(...)" to "public void onActivityResult(...)".

    2) change "RESULT_OK" for "Activity.RESULT_OK" and import android.app.Activity (or you could change it to -1 which I believe is the value for this constant).

    I think that's it. The highlighter will show errors on onActivityResult() and on startActivityForResult() but the code will compile and run properly.

    ReplyDelete
    Replies
    1. Thanks Felipe - I am sure many will benefit from this information.
      Thank you very much.

      Delete
    2. Thank you! It is finally working!

      Delete
  25. Same as Scott C.
    Thank you.

    ReplyDelete
  26. Hello, Scott. Thank you so much for this tutorial it is everything I needed to know. I am experiencing a problem after I try to upload the first simple sketch on my Android (Lenovo A328). Everything seems to be fine on Processing end but when the phone launches the sketch it is just white screen. It is like the actual image is not generating at all. Any ideas?

    ReplyDelete
  27. Hi, I am using micromax a310 device i have used all the 3 code but the problem is it shows white screen on the micromax a310 screen
    second problem is that the green symbol is not displayed in processing utility. i have used api19 version 4.4.2

    ReplyDelete
  28. First Example is working fine ... No problem .. Second example gives following error ..
    APButton cannot be resolved to a type
    ----------
    18. ERROR in C:\Users\ADMIN\AppData\Local\Temp\android7030721473606456066sketch\src\processing\test\bluetoothbuttons\BluetoothButtons.java (at line 44)
    widgetContainer.addWidget(blueButton);//place blue button in container
    ^^^^^^^^^^^^^^^
    APWidgetContainer cannot be resolved to a type
    ----------
    19. ERROR in C:\Users\ADMIN\AppData\Local\Temp\android7030721473606456066sketch\src\processing\test\bluetoothbuttons\BluetoothButtons.java (at line 44)
    widgetContainer.addWidget(blueButton);//place blue button in container
    ^^^^^^^^^^
    APButton cannot be resolved to a type
    ----------
    20. ERROR in C:\Users\ADMIN\AppData\Local\Temp\android7030721473606456066sketch\src\processing\test\bluetoothbuttons\BluetoothButtons.java (at line 45)
    widgetContainer.addWidget(offButton);//place off button in container
    ^^^^^^^^^^^^^^^

    ReplyDelete
    Replies
    1. The examples work if you follow them exactly - but my guess is that you are using a different version of Processing/Android to the one I used. I am not exactly sure which sketch you are referring to.

      Delete

Feel free to leave a comment about this tutorial below.
Any questions about your particular project should be asked in the ArduinoBasics forum.

Comments are moderated due to large amount of spam.