🛠️ Dive into our collection of DIY Kits, 🔊 Audio Amplifiers, Digital Scoreboards, FM transmitters, and more!
🎶 Explore endless possibilities at our new store.


Light sensor using Amarino Plugin

#include <MeetAndroid.h>
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(13, 12, 10, 9, 8, 7);
MeetAndroid meetAndroid;
int ledPin = 11;
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
lcd.begin(16, 2);
lcd.print("Light sensor");
// initialize the serial communications:
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
// small letters are custom events, capital letters inbuilt Amarino events
meetAndroid.registerFunction(intValue, 'A');
}
void loop()
{
meetAndroid.receive(); // you need to keep this in your loop() to receive events
}
void intValue(byte flag, byte numOfValues)
{
int v = meetAndroid.getInt();
analogWrite(ledPin,v);
lcd.clear();
lcd.print("Light data:");
lcd.print(v);
Serial.println(v);
}


🛠️ Dive into our collection of DIY Kits, 🔊 Audio Amplifiers, Digital Scoreboards, FM transmitters, and more!
🎶 Explore endless possibilities at our new store.


Leave a Reply

Your email address will not be published. Required fields are marked *