Secret Box
Function
LinkIt ONE with Grove - Light Sensor, put into a box. when the box is opened, a message will be sent to your phone.
Connection
GSM antenna
SIM Card
Li Battery
Code
// demo of Grove Starter kit for LinkIt ONE
// Secret box
#include <LGSM.h>
char num[20] = "13425171053"; // your number write here
char text[100] = "Warning: Your box had been opened!!"; // what do you want to send
const int pinLight = A0; // light sensor connect to A0
bool isLightInBox()
{
return (analogRead(pinLight)<50); // when get data less than 50, means light sensor was in box
}
void setup()
{
Serial.begin(115200);
while(!isLightInBox()); // until put in box
delay(2000);
}
void loop()
{
if(!isLightInBox()) // box is open
{
Serial.println("box had been opened");
while(!LSMS.ready())
{
delay(1000);
}
Serial.println("SIM ready for work!");
LSMS.beginSMS(num);
LSMS.print(text);
if(LSMS.endSMS())
{
Serial.println("SMS is sent");
}
else
{
Serial.println("SMS send fail");
}
while(!isLightInBox()); // until put in box
delay(2000);
}
delay(10);
}
Tech Support & Product Discussion
Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.