Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
Sends sensor data to Android
(needs SensorGraph and Amarino app installed and running on Android)
*/
#include <MeetAndroid.h>
MeetAndroid meetAndroid;
int sensor = A1;
int redLed = 11;
void setup()
{
// use the baud rate your bluetooth module is configured to
Serial.begin(9600);
pinMode(sensor, INPUT);
meetAndroid.registerFunction(red, 'o');
pinMode(redLed, OUTPUT);
analogWrite(redLed, 20);
}
void loop()
{
meetAndroid.receive(); // you need to keep this in your loop() to receive events
meetAndroid.send(analogRead(sensor));
// add a little delay otherwise the phone is pretty busy
delay(100);
}
void red(byte flag, byte numOfValues)
{
analogWrite(redLed, meetAndroid.getInt());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.