5.6. Example code
We provide below with a code suitable for take a picture and send via FTP server. Take into account that to work with this
example you need an FTP account.
/*
* This example shows how use the presence sensor interrupt taking a
* picture and uploading it when the interrupt occurs. To use this example,
*
a Video Camera Sensor Board with presence sensor is required.
*
*
Copyright (C) 2013 Libelium Comunicaciones Distribuidas S.L.
*
http://www.libelium.com
*
*
This program is free software: you can redistribute it and/or modify
*
it under the terms of the GNU General Public License as published by
*
the Free Software Foundation, either version 3 of the License, or
*
(at your option) any later version.
*
*
This program is distributed in the hope that it will be useful,
*
but WITHOUT ANY WARRANTY; without even the implied warranty of
*
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
GNU General Public License for more details.
*
*
You should have received a copy of the GNU General Public License
*
along with this program.
*
*
Version:
*
Design:
* Implementation: Alejandro Gállego
*/
#include "Wasp3G.h"
int count=0;
int answer=0;
char picture_name[30];
void setup(){
USB.ON();
USB.println(F("Starting"));
// Activates the 3G module:
while (_3G.ON() != 1){
USB.println(F("Waiting..."));
}
USB.println(F("3G module ready..."));
_3G.setTime();
_3G.setMode(_3G_RF_OFF);
USB.println(F("RF circuits disabled"));
// if there isn't a name the 3G module use the date and time for the picture's name
_3G.pictureName("");
// waits for SD and then selects as storage
USB.println("Waiting for SD...");
while ((_3G.isSD() == 0));
_3G.selectStorage(1);
intArray[PIR_3G_POS] = 0;
}
If not, see <http://www.gnu.org/licenses/>.
1.0
David Gascón
-29-
Board configuration and programming
See the
v4.3
Need help?
Do you have a question about the Waspmote and is the answer not in the manual?