HOWTO – Debug an AOSP – CM java application

Just a little reminder for the future

Run DDMS and select the process that you want to debug (for example, com.android.calendar).

Now, in eclipse, you can attach to the emulator or device:

  1. Run > Open Debug Dialog…
  2. Right-click “Remote Java Application”, select “New”.
  3. Pick a name, i.e. “android-debug” or anything you like.
  4. Set the “Project” to your project name.
  5. Keep the Host set to “localhost”, but change Port to 8700.
  6. Click the “Debug” button and you should be all set.

Note that port 8700 is attached to whatever process is currently selected in the DDMS console, so you need to sure that DDMS has selected the process you want to debug

Bluetooth HC-06 + Arduino + RX1 and TX1

Yes…I’m alive.
It’s about 1 year that I didn’t post something on this wonderful blog but I’ve been quite busy.

But some days ago I bought a bluetooth module (HC-06, the cheapest module for Arduino) in order to integrate wireless capability in my HomeTemp project, and I want to share a simple thing about its configuration:

DO NOT WIRE THE MODULE TO RX1 (pin 0) AND TX1 (pin 1).

I tried the easiest way to connect the module to an Arduino UNO board, using the standard RX1 and TX1 pin, but the behavior was a little confusing:

  • The module sends correctly data via bluetooth
  • The module does not receive any data via bluetooth

I didn’t understand why…maybe a “conflict” with the standard Serial USB communication. But after some experiments  I found a post somewhere that suggests to use the “SoftwareSerial” Arduino Library and use two others PIN (10 and 11). With this simple configuration the following example works like a charm 🙂 Not all pins support change interrupts, check the SoftwareSerial page and check which pins should work.

Pair the device with your PC (the default pairing PIN is 1234) and then open a serial console (on Mac OSX I use “screen /dev/tty.XXXYYZZZ). You are now able to read and send data.

I hope it could be helpful to someone.


#include <SoftwareSerial.h>
#define LED_PIN 12

SoftwareSerial bluetoothSerial(10, 11);

void setup() {
  pinMode(LED_PIN, OUTPUT);  

  
  Serial.begin(57600);

  bluetoothSerial.begin(9600);
  bluetoothSerial.println("I'm ready");
  
  digitalWrite(LED_PIN, LOW);
  delay(300);
  digitalWrite(LED_PIN, HIGH);
  delay(300);
  digitalWrite(LED_PIN, LOW);
  delay(300);
  digitalWrite(LED_PIN, HIGH);
  delay(300);
  digitalWrite(LED_PIN, LOW);
  
  Serial.print("Ready to go");  

}

void loop() {

  if (bluetoothSerial.available() > 0) {
    char inChar = bluetoothSerial.read();
    if (inChar == '1') {
        digitalWrite(LED_PIN, HIGH);
        bluetoothSerial.print("ON");
    }
    else if (inChar == '0'){
        digitalWrite(LED_PIN, LOW);
        bluetoothSerial.print("OFF");
    }
  } 

}

CanonTimer Version 1

Welcome to my first Arduino DIY project. I need a intervalometer in order to do some time-lapse video. On amazon or ebay you can find a standard timer for less than 40€ but I want to build it by myself 🙂

A lot of DIY timer can be discovered using Google, but this is too simple. So I bought an Arduino Uno, some electronics parts, and now I can share my CanonTimer project with the first version!

SchemaYou can found the Arduino code and schematics on my Bitbuchet GIT repository.

In this first version the user interface is very simple:  there are nine hardcoded delays assigned to nine different programs

  • 5 seconds – Program 0
  • 10 seconds – Program 1
  • 15 seconds – Program 2
  • 30 seconds – Program 3
  • 45 seconds – Program 4
  • 60 seconds – Program 5
  • 90 seconds – Program 6
  • 120 seconds – Program 7
  • 180 seconds – Program 8
  • 300 seconds – Program 9

You can select the time delay using the right button. Once the program is selected, you can start the timer using the left button. Every XX seconds the led will blink.

Yes…the led…in this first version there isn’t a real connection to a Canon Camera. In the upcoming releases I will introduce some other improvements:

  • Wired connection to the Canon Camera 🙂
  • A more complete user interface, without hardcoded time delays but with a 4 digit 7-segment display and (+) and (-) buttons in order to specify a custom delay

 

Welcome back, and happy new year!

I’m back…and I’m back with a lot of news 🙂

  • First of all, I changed the website hosting. After some years of (free) web hosting I had to search for another solution for this site and for another two blogs that I manage. (www.asvirtus.it and www.bandacastanoprimo.it).  My choice was the Shared Hosting by DreamHost.com. Cheap, no limits, fast setup, easy control panel….so perfect to me!
  • After four months waiting for the 9$ Arduino Board (my shipment is lost, I think) I decided to buy an Arduino Uno on Ebay for a new small project…more news coming soon 🙂Schema
  • I published a new little Android software on Google Play, “Webcam Valle d’Aosta”: a very simple application that shows the main webcam of Italian Alps (no english translation, only italian)
  • The last news is…my new Laptop.  After 5 years I said “GoodBye” to my old Sony Vaio and I’ve joined the “Apple” side with a beautiful and powerful Mac©®™ Book Pro Retina 13”. Yes….I’ve always been an Apple enemy and a great fanboy of OpenSource and Linux. But now I’m old…and bored of spending my time configuring my laptop at every “apt-get upgrade”. A new laptop with Windows 8 is the worst thing, so I chose a “working and easy to use” version of Linux: Mac®™© OS-X. I can do everything with it: coding and programming (arduino, android, cyanogenMod), photo editing, playing with my favorites games (Diablo III for example works like a charm on my Retina©™® display) etc etc etc…Yes…the MBP-Retina is a little bit expensive (with expanded RAM – 16GB ), but this little boy is, simple, perfect.

So…happy new year and stay tuned for the next news 🙂

Fixed .classpath file for Motorola Jordan

I think that I am the last CyanogenMod Motorola Defy developer in the whole world. But if you plan to develop something for the old Motorola defy (aka jordan aka mb526) and your eclipse classpath is completely messed up, you can find a fixed “.classpath” in my GitHub repo. Simply download the “ide/eclipse/.classpath” file and put it in your project folder. It fixes all the FM Radio releated classes and libraries (fmradio, com.stericsson … etc etc): with this .classpath file you can use Eclipse in order to debug (on device) your mods.

Mission Accomplished

My first CyanogenMod new (little) feature is born. Today I’ve finished the “Development shortcut” project. It enables the wipe data and application force close option in the recent tasks list and in the notification area. These options will be available only if the Development mode is enabled.

device-2013-11-02-140109 device-2013-11-02-140037

The first version is only for Motorola defy mb525 and is available on my github repo. I do a pull request to Quarx2k in order to merge my mod in his “official” Motorola repo.

The next step is to merge it in the official CM dev branch and submit it to gerrit review. But the first CyanogenmMod 10.2 M build is coming (this weekend) with the code freeze phase. I have to be quick!