test chata
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"name": "Arduino-GSM-Chata",
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"files.associations": {
|
||||||
|
"pinsdefinitions": "c",
|
||||||
|
"new": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "GSMMobileData.h"
|
#include "GSMMobileData.h"
|
||||||
#include "EEPROMUtils.h"
|
#include "EEPROMUtils.h"
|
||||||
#include "DeviceBase.h"
|
#include "DeviceBase.h"
|
||||||
#include "DebugLog.h"
|
|
||||||
|
|
||||||
GSMMobileData::GSMMobileData(String id) : DeviceBase(id)
|
GSMMobileData::GSMMobileData(String id) : DeviceBase(id)
|
||||||
{
|
{
|
||||||
@@ -15,10 +15,6 @@ void GSMMobileData::readAllData(String id)
|
|||||||
EEPROMUtils eepromUtils = EEPROMUtils();
|
EEPROMUtils eepromUtils = EEPROMUtils();
|
||||||
MobileNumber = eepromUtils.readString(1, 20);
|
MobileNumber = eepromUtils.readString(1, 20);
|
||||||
Sms = eepromUtils.readString(21, 100);
|
Sms = eepromUtils.readString(21, 100);
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
DebugLog::log("Load from EEPROM. Mobile Number: " + MobileNumber + " SMS: " + Sms);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSMMobileData::updateMobileNumber(const String &newMobileNumber)
|
void GSMMobileData::updateMobileNumber(const String &newMobileNumber)
|
||||||
@@ -33,9 +29,6 @@ void GSMMobileData::updateMobileNumber(const String &newMobileNumber)
|
|||||||
EEPROMUtils eepromUtils = EEPROMUtils();
|
EEPROMUtils eepromUtils = EEPROMUtils();
|
||||||
MobileNumber = newMobileNumber;
|
MobileNumber = newMobileNumber;
|
||||||
eepromUtils.writeString(1, newMobileNumber, 20);
|
eepromUtils.writeString(1, newMobileNumber, 20);
|
||||||
#ifdef DEBUG
|
|
||||||
DebugLog::log("Update Mobile Number: " + newMobileNumber);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,8 +43,5 @@ void GSMMobileData::updateSMS(const String &newSMS)
|
|||||||
EEPROMUtils eepromUtils = EEPROMUtils();
|
EEPROMUtils eepromUtils = EEPROMUtils();
|
||||||
Sms = newSMS;
|
Sms = newSMS;
|
||||||
eepromUtils.writeString(21, newSMS, 100);
|
eepromUtils.writeString(21, newSMS, 100);
|
||||||
#ifdef DEBUG
|
|
||||||
DebugLog::log("Update sms: " + newSMS);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "PinTypeOut.h"
|
#include "PinTypeOut.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "DebugLog.h"
|
|
||||||
|
|
||||||
|
|
||||||
void PinTypeOut::setOutputSignalToHigh()
|
void PinTypeOut::setOutputSignalToHigh()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <WebServerData.h>
|
/*#include <WebServerData.h>
|
||||||
#include <Ethernet.h>
|
#include <Ethernet.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
@@ -46,3 +46,4 @@ String WebServerData::removeAllCharactersAfterEmptySpace(String &data)
|
|||||||
data.replace("_", " ");
|
data.replace("_", " ");
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#ifndef WebServerData_H
|
/*ifndef WebServerData_H
|
||||||
#define WebServerData_H
|
#define WebServerData_H
|
||||||
|
|
||||||
#include <Ethernet.h>
|
#include <Ethernet.h>
|
||||||
@@ -19,4 +19,5 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WebServerData_H
|
#endif // WebServerData_H
|
||||||
|
*/
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include <Arduino.h>
|
/*#include <Arduino.h>
|
||||||
#include <Ethernet.h>
|
#include <Ethernet.h>
|
||||||
#include "WebServer.h"
|
#include "WebServer.h"
|
||||||
#include "WebServerData.h"
|
#include "WebServerData.h"
|
||||||
@@ -134,3 +134,4 @@ void WebServer::SendToBrowser(const String &dataString)
|
|||||||
}
|
}
|
||||||
client.println("");
|
client.println("");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#ifndef WebServer_H
|
/*#ifndef WebServer_H
|
||||||
#define WebServer_H
|
#define WebServer_H
|
||||||
|
|
||||||
#include <WebServerData.h>
|
#include <WebServerData.h>
|
||||||
@@ -23,4 +23,5 @@ private:
|
|||||||
void SendToBrowser(const String &dataString);
|
void SendToBrowser(const String &dataString);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WebServer_H
|
#endif // WebServer_H
|
||||||
|
*/
|
||||||
+5
-4
@@ -12,8 +12,9 @@
|
|||||||
platform = atmelavr
|
platform = atmelavr
|
||||||
board = uno
|
board = uno
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
debug_tool = avr-stub
|
||||||
arduino-libraries/Ethernet@^2.0.2
|
debug_port = COM8
|
||||||
featherfly/SoftwareSerial@^1.0
|
monitor_port = COM8
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
lib_deps =
|
||||||
|
jdolinay/avr-debugger@^1.5
|
||||||
|
|||||||
+12
-15
@@ -1,14 +1,15 @@
|
|||||||
#include "GSMMobileDevice.h"
|
#include "GSMMobileDevice.h"
|
||||||
#include "WebServer.h"
|
//#include "WebServer.h"
|
||||||
#include "PinTypeIn.h"
|
#include "PinTypeIn.h"
|
||||||
#include "PinTypeOut.h"
|
#include "PinTypeOut.h"
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <IPAddress.h>
|
//#include <IPAddress.h>
|
||||||
#include <Ethernet.h>
|
// #include <Ethernet.h>
|
||||||
#include "WebServer.h"
|
// #include "WebServer.h"
|
||||||
#include "WebServerData.h"
|
// #include "WebServerData.h"
|
||||||
#include "DebugLog.h"
|
|
||||||
#include "HTMLGenerator.h"
|
//#include "HTMLGenerator.h"
|
||||||
|
#include "avr8-stub.h"
|
||||||
|
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ static const PinTypeOut OUPUTS_PINS_ARRAY[COUNT_OUTPUTS_PIN_OUT] = {PinOutAlarm8
|
|||||||
|
|
||||||
// PIN INPUT Initialization as INPUT
|
// PIN INPUT Initialization as INPUT
|
||||||
static const int COUNT_INPUTS_PIN_IN = 2;
|
static const int COUNT_INPUTS_PIN_IN = 2;
|
||||||
static PinTypeIn PinInEZSAlarm2 = PinTypeIn("PIN2", 2, 100, "Input EZS ALARM"); // 100ms debounce;
|
static PinTypeIn PinInEZSAlarm2 = PinTypeIn("PIN4", 4, 100, "Input EZS ALARM"); // 100ms debounce;
|
||||||
static PinTypeIn PinInCaseOpen3 = PinTypeIn("PIN3", 3, 100, "Input Contact Box");
|
static PinTypeIn PinInCaseOpen3 = PinTypeIn("PIN3", 3, 100, "Input Contact Box");
|
||||||
static const PinTypeIn INPUTS_PINS_ARRAY[COUNT_INPUTS_PIN_IN] = {PinInEZSAlarm2, PinInCaseOpen3};
|
static const PinTypeIn INPUTS_PINS_ARRAY[COUNT_INPUTS_PIN_IN] = {PinInEZSAlarm2, PinInCaseOpen3};
|
||||||
|
|
||||||
@@ -35,19 +36,15 @@ GSMMobileData gsmData = GSMMobileData("GSM");
|
|||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
debug_init();
|
||||||
DebugLog::init(115200);
|
|
||||||
DebugLog::log("Called: Setup and init GSM");
|
|
||||||
DebugLog::log("Init GSM is OK");
|
|
||||||
#endif
|
|
||||||
// gsmDevice.init();
|
|
||||||
gsmData.MobileNumber = "+420608126674";
|
gsmData.MobileNumber = "+420608126674";
|
||||||
gsmData.Sms = "Alarm EZS CHATA";
|
gsmData.Sms = "Alarm EZS CHATA";
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
DebugLog::log("PIN IN 2: " + String(PinInEZSAlarm2.IsPinHigh()));
|
;
|
||||||
if (PinInEZSAlarm2.IsPinHigh())
|
if (PinInEZSAlarm2.IsPinHigh())
|
||||||
{
|
{
|
||||||
PinOutAlarm8.setOutputSignalToHigh();
|
PinOutAlarm8.setOutputSignalToHigh();
|
||||||
|
|||||||
Reference in New Issue
Block a user