Sketch- Test Amarino

Get the sketch: https://gist.github.com/buildcircuit/3939682
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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); | |
} |