Arduino to respond to Android phone vibrations (via Amarino)

Hi I'm new to Arduino (and Amarino) and I'm looking for some help with a school project. People here seem a little more active than the forum on Amarino, so I figure I try my luck here :blush:

I'm using:

  • Lilypad Simple (it's the new one, and after much frustration, it came down to jumping the power from + to VCC...)
  • Bluetooth Mate Silver
  • Lilypad Vibe Board
  • Samsung Galaxy S3

I want the Lilypad vibe board to vibrate according to different notifications I get from my Android phone. For instance, a text message is 2 short pulses and a phone call is a series of continuous pulses. Does anyone know where I can find a tutorial on this or already have a code I can build off of? I only got as far as being able to pair my phone with the Lilypad + BT modem and run the MeetAndroid>Test Event.

Ideally I want it to also respond to social notifications as well (Facebook, Twitter etc.). In this case, the ideal final solution is for the Lilypad vibe board to react exactly the same as the vibration motor inside my phone (since the phone already have different vibration patterns to different notification events). Is there code for this? Or any suggestions?

Any help is much appreciated! Thanks!

Having next to none programming knowledge, I managed to get this far from picking various bits in the library/tutorials.

The problem with something like this is that the text message HAS to be 'hey'....which is pretty useless. What needs to change in the code so that ANY text message notification will set off the vibration motor on the Arduino side?

#include <MeetAndroid.h>
// declare MeetAndroid so that you can call functions with it
MeetAndroid meetAndroid;
// starting with 1 LED
int vibe = 10;
void setup()
{
  // use the baud rate your bluetooth module is configured to
  // not all baud rates are working well, i.e. ATMEGA168 works best with 57600
  Serial.begin(115200);
  // register callback functions, which will be called when an associated event occurs.
  meetAndroid.registerFunction(LEDon, 'A');  
  pinMode(vibe, OUTPUT);
  digitalWrite(vibe, LOW);
}
void loop()
{
  meetAndroid.receive(); // you need to keep this in your loop() to receive events
}
void LEDon (byte flag, byte numOfValues)

{

  int values[]={
    0  };

  meetAndroid.getIntValues(values);

  //Text message content
  int X=values[1];
  if (X = 'hey') {
    digitalWrite(vibe, HIGH); // set the Vibe on
    delay(800);              // wait for a second
    digitalWrite(vibe, LOW);    // set the Vibe off
    delay(800);
    digitalWrite(vibe, HIGH);
    delay(800);
    digitalWrite(vibe, LOW);   
     }

  else
  {
    digitalWrite(vibe, LOW);
  }
}
  int values[]={
    0  };

The size of the array is defined either in the square brackets or counting initializers. Pray, tell what advantage a one element array has over a scalar variable.

  int X=values[1];
  if (X = 'hey') {

A one element array does not have an element at index 1. The value X can be assigned the multibyte character 'hey' but what good is that?

The problem with something like this is that the text message HAS to be 'hey'

If you expect to store "hey" in one character, you are going to be disappointed. Why you want to store characters in an int escapes me. How you think you are going to store 4 characters, including the trailing NULL, in a two byte int escapes me.

What needs to change in the code so that ANY text message notification will set off the vibration motor on the Arduino side?

Lots of stuff. To start with, getIntValues() is not the way to retrieve a test message.

At one point, I too had the meetAndroid sketch, but it was not working for me and because I already know Java, I went ahead and made my own Android program to talk to my robot. Since your new to programing (all programing in general), Java may be a little TOO much for you.

HOWEVER, If by some chance you do learn some java, you might want to start with a program called Bluetooth Chat. It is a basic program that can scan for bluetooth devices and establish a connection to talk to one another. I used that very program to first test my robot to see if the BT module worked or not, and fom there on I made my own.

I also successfully just recently made a Arduino controller with a 3.2" touchscreen, accelerometer and BT master module, that is byfar MUCH cheaper to buy and program than the Samsung Galaxy S2 tablet I used.

** I will see if I can get the meetAndroid sketch again and try to point you in the right direction.