what goes wrong?
//librarys
#include <GSM.h> //GSM
#include <OneWire.h> //Sensor
#include <DallasTemperature.h> //Sensor
#include <EEPROM.h> //Offline SAVE
////Telefoon
#define PINNUMBER "0000"
GSM gsmAccess;
GSM_SMS sms;
// Temperature
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// Hardware adres DS18B20 PIN 4
DeviceAddress Thermometer = { 0x28, 0xBF, 0x64, 0xA3, 0x06, 0x00, 0x00, 0xC3 };
//Variable
int AlarmOn = 1; //=1 AAN =0 OFF
int Sensor = 0; //=0 IS FOUT
int InkomendeSMS = 0;
float TEMPAlarm = 10.00; //TEMP ALARM
float tempC ;
float voltage ;
char Naam[17] = "Nacht1 Online"; //MAX 10 karakters
////Telefoonnummers Beheerders
char TelB1[14] = "+31600000000";
////Telefoonnummers Leden
char NrSMSOntvangen[14];
//Global files
byte ALARM_FLAG = 0;
String textStatusSMS;
String textOnlineSMS;
String ALARMStatus;
String voltageMelding;
String message1;
String message2;
String SensorStatus;
String NRSENDSMS;
//SETUP
void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println("<> Aan");
analogReference(INTERNAL);
// SIMmodule
// Connection state
boolean notConnected = true;
Serial.println("Offline");
// Start GSM shield
while(notConnected){
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else{
Serial.println("Offline wacht op nieuwe poging");
delay(1000);
}
}
// Start library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(Thermometer, 10);
Serial.print("TEMP Online");
//SMS Online
Serial.print("Online SMS ");
sendSMSOnline();
}
//LOOP
void loop(void)
{
int sensorValue = analogRead(A0);
voltage = sensorValue * (12 / 1023.0);
Serial.print(voltage);
Serial.println("\n");
if (voltage < 6.75 ) {
ALARM_FLAG = 1;
}
Serial.print("Meten...\n\r");
sensors.requestTemperatures();
Serial.print("Temperature ");
TempControl(Thermometer);
Serial.print("\n\r");
//Check
SMSOntvangen();
if ( AlarmOn == 1 ) {
if ( ALARM_FLAG == 1 ) {
Serial.println("Alarm geactiveerd");
InkomendeSMS = 0;
SMSALARM();
}
}
delay (100);
}
// Temperatuur sensor
void TempControl(DeviceAddress deviceAddress) {
tempC = sensors.getTempC(deviceAddress);
Serial.println(tempC);
// float tempC = sensors.getTempC(deviceAddress);
Serial.println(tempC);
Sensor = 0;
if (tempC < -100.00) {
Serial.print("Sensor is niet verbonden");
ALARM_FLAG = 1;
}
else if (tempC <= (float) TEMPAlarm) {
Serial.print("C: ");
Serial.print(tempC);
ALARM_FLAG = 1;
Sensor = 1;
SMSALARM();
}
else {
Serial.print("> ingestelde waarde, het is nu *C ");
Serial.print(tempC);
Sensor = 1;
}
}
//SMS Ontvangen
void SMSOntvangen() {
char c;
if (sms.available()) {
// Get remote number
sms.remoteNumber(NrSMSOntvangen, 14);
Serial.println(NrSMSOntvangen);
if (sms.peek() == '#') {
Serial.println("Discarded SMS");
sms.flush();
}
// Read message bytes and print them
while (c = sms.read()) {
if (c == '1') {
Serial.println("SMS ONTVANGEN 1");
AlarmOn = 0;
InkomendeSMS = 1;
SMSALARM();
}
else if (c == '2') {
Serial.println("SMS ONTVANGEN 2");
AlarmOn = 1;
InkomendeSMS = 1;
SMSALARM();
}
else if (c == '3') {
Serial.println("SMS ONTVANGEN 3");
InkomendeSMS = 1;
SMSALARM();
}
else {
Serial.println("FOUT COMMANDO!");
}
}
sms.flush();
Serial.println("Verwijder bericht");
}
}
void sendSMSOnline() {
Serial.print("SMS");
Serial.println(TelB1);
textOnlineSMS.concat(Naam);
textStatusSMS.concat ( "\n");
textStatusSMS.concat("Meld status Online");
Serial.println(textOnlineSMS);
// send the message
sms.beginSMS(TelB1);
sms.print(textOnlineSMS);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}
void SMSALARM() {
Serial.print("\n\n Nummer:");
Serial.println(TelB1);
if (InkomendeSMS == 1)
{
NRSENDSMS = (NrSMSOntvangen);
}
else {
NRSENDSMS = (TelB1);
}
if (ALARM_FLAG >= 1) {
message1 = "ALARM";
message2 = " ALERT";
}
else if (ALARM_FLAG == 0) {
message1 = "STATUS";
message2 = " REPORT";
}
if (AlarmOn == 1 ) {
ALARMStatus = " AAN";
}
else {
ALARMStatus = " UIT";
}
if (Sensor == 1 ) {
SensorStatus = " OK";
}
else {
SensorStatus = " FOUT!";
}
if (voltage > 6.75 ) {
voltageMelding = " OK";
}
else if (voltage > 6.00 ) {
voltageMelding = " Gevaarlijk laag!";
}
else {
voltageMelding = " ALARM, ONLINE STATUS IN GEVAAR!";
}
textStatusSMS.concat(Naam) + "\n";
textStatusSMS.concat("------ \n");
textStatusSMS = message1 + message2 + "\n";
textStatusSMS.concat("------ \n");
textStatusSMS.concat("Temperatuur ");
textStatusSMS.concat((float)tempC);
textStatusSMS.concat(" *C \n\n");
textStatusSMS.concat("Huidige instellingen: \n");
textStatusSMS.concat("------ \n");
textStatusSMS.concat ("Alarm:");
textStatusSMS.concat (ALARMStatus) + " \n";
textStatusSMS.concat("Alarm temperatuur: ");
textStatusSMS.concat((float)TEMPAlarm);
textStatusSMS.concat(" *C\n");
textStatusSMS.concat("Voltage: ");
textStatusSMS.concat(voltage) + " V";
textStatusSMS.concat(voltageMelding) + " \n";
textStatusSMS.concat ("Sensor:");
textStatusSMS.concat (SensorStatus);
delay (100);
// sms text
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(textStatusSMS);
// send the message
sms.beginSMS(NrSMSOntvangen);
sms.print(textStatusSMS);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
ALARM_FLAG = 0;
InkomendeSMS = 0;
}
VVVVVVVVVV
In file included from /Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM.h:46:0,
from /Users/Maikel/Documents/Arduino/Temp6/Temp6.ino:2:
/Applications/Arduino.app/Contents/Java/libraries/GSM/src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration [enabled by default]
typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};
^
/Users/Maikel/Documents/Arduino/Temp6/Temp6.ino: In function 'void setup()':
/Users/Maikel/Documents/Arduino/Temp6/Temp6.ino:67:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
^
Sketch uses 24,604 bytes (76%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,553 bytes (75%) of dynamic memory, leaving 495 bytes for local variables. Maximum is 2,048 bytes.
Low memory available, stability problems may occur.