Topic: GUI stops working
I am using ESP 8266 and Arduino UNO
This is my code
/*
-- ThermalCycler --
This source code of graphical user interface
has been generated automatically by RemoteXY editor.
To compile this code using RemoteXY library 2.4.3 or later version
download by link http://remotexy.com/en/library/
To connect using RemoteXY mobile app by link http://remotexy.com/en/download/
- for ANDROID 4.5.1 or later version;
- for iOS 1.4.1 or later version;
This source code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
*/
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT
#include <RemoteXY.h>
#include <time.h>
// RemoteXY connection settings
#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 115200
#define REMOTEXY_WIFI_SSID "RemoteXY"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377
int coolMode = 9; // Cooling Relay connected to Pin 9
int heatMode = 10; // Heating Relay connected to Pin 10
int fan = 11; //Fan Relay connected to Pin 11
int ThermistorPin = 0; //Thermistor connected to Analog Pin 0
unsigned long startTime; //Time measured in milliseconds
float denaturingTemp;
float annealingTemp;
float extensionTemp;
int numberCycles;
int currentCycles;
// Thermistor Variables Definitions
int Vo;
float R1 = 10000;
float logR2, R2, T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
float Temp;
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,15,0,4,0,180,0,10,16,0,
7,12,15,36,18,4,2,26,2,3,
7,12,15,46,18,4,2,26,2,3,
7,12,15,55,18,4,2,26,2,3,
129,0,7,32,35,3,24,68,101,110,
97,116,117,114,105,110,103,32,84,101,
109,112,101,114,97,116,117,114,101,0,
129,0,7,42,34,3,24,65,110,110,
101,97,108,105,110,103,32,84,101,109,
112,101,114,97,116,117,114,101,0,129,
0,8,51,34,3,24,69,120,116,101,
110,115,105,111,110,32,84,101,109,112,
101,114,97,116,117,114,101,0,68,17,
3,2,94,27,8,36,7,20,50,36,
14,4,2,26,2,129,0,48,32,19,
3,24,78,111,46,32,111,102,32,67,
121,99,108,101,115,0,2,0,72,43,
22,10,2,26,31,31,83,84,65,82,
84,0,83,84,79,80,0 };
// this structure defines all the variables and events of your control interface
struct {
// input variables
float denatTemp;
float anneaTemp;
float extenTemp;
int16_t numbCycles; // 32767.. +32767
uint8_t switch_1; // =1 if switch ON and =0 if OFF
// output variables
float Temperature;
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
void setup()
{
RemoteXY_Init ();
pinMode(coolMode, OUTPUT);
pinMode(heatMode, OUTPUT);
pinMode(fan, OUTPUT);
// TODO you setup code
}
void loop()
{
RemoteXY_Handler ();
denaturingTemp = RemoteXY.denatTemp;
annealingTemp = RemoteXY.anneaTemp;
extensionTemp = RemoteXY.extenTemp;
numberCycles = RemoteXY.numbCycles;
Temp = thermistorTemp();
RemoteXY.Temperature = Temp;
digitalWrite(heatMode, HIGH);
digitalWrite(coolMode, HIGH);
digitalWrite(fan, HIGH);
while(RemoteXY.switch_1==1)
{
for(int currentCycle = 0; currentCycle<=numberCycles; currentCycles++)
{
maintainTemp(denaturingTemp);
maintainTemp(annealingTemp);
maintainTemp(extensionTemp);
}
}
}
void maintainTemp(float setpoint)
{
startTime = millis();
while((millis()-startTime)<60000)
{
Temp = thermistorTemp();
RemoteXY.Temperature = Temp;
while(Temp<setpoint)
{
digitalWrite(heatMode, LOW);
digitalWrite(coolMode, HIGH);
digitalWrite(fan, HIGH);
Temp = thermistorTemp();
RemoteXY.Temperature = Temp;
delay(500);
}
while(Temp>setpoint+2)
{
digitalWrite(heatMode, HIGH);
digitalWrite(coolMode, LOW);
digitalWrite(fan, LOW);
Temp = thermistorTemp();
RemoteXY.Temperature = Temp;
delay(500);
}
}
}
float thermistorTemp()
{
Vo = analogRead(ThermistorPin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
T = T - 273.15;
return T;
delay(500);
}
When I enter all the parameters and switch it to start, the graph freezes, and after a few seconds the GUI quits.
What can be the reason?