Skip to content

Instantly share code, notes, and snippets.

@buildcircuit
Created October 23, 2012 16:04
Show Gist options
  • Save buildcircuit/3939682 to your computer and use it in GitHub Desktop.
Save buildcircuit/3939682 to your computer and use it in GitHub Desktop.
Test Amarino- Amarino Evaluation Shield
/*
Receives Test Events from your phone.
After it gets a test message the led 11 will blink
for one second.
*/
#include <MeetAndroid.h>
MeetAndroid meetAndroid;
int onboardLed = 11;
void setup()
{
Serial.begin(9600);
// register callback functions, which will be called when an associated event occurs.
// - the first parameter is the name of your function (see below)
// - match the second parameter ('A', 'B', 'a', etc...) with the flag on your Android application
meetAndroid.registerFunction(testEvent, 'A');
pinMode(onboardLed, OUTPUT);
digitalWrite(onboardLed, HIGH);
}
void loop()
{
meetAndroid.receive(); // you need to keep this in your loop() to receive events
}
/*
* This method is called constantly.
* note: flag is in this case 'A' and numOfValues is 0 (since test event doesn't send any data)
*/
void testEvent(byte flag, byte numOfValues)
{
flushLed(300);
flushLed(300);
}
void flushLed(int time)
{
digitalWrite(onboardLed, LOW);
delay(time);
digitalWrite(onboardLed, HIGH);
delay(time);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment