#include <eHealth.h>
#include <eHealthDisplay.h>
void setup() {
eHealth.readGlucometer();
Serial.begin(115200);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
float temperature;
digitalWrite(3,LOW);
digitalWrite(2,LOW);
char x=Serial.read();
Temp: // LABEL FOR THE TEMPERATURE MEASUREMENTS
temperature = eHealth.getTemperature();
Serial.println(temperature);
delay (100);
x=Serial.read();
if (x=='G') // 'G' G STANDS FOR GLUCOSE, IT MATCHES WITH THE MATLAB CODE
{Serial.println("Switching to Glucose measuring...");
goto Glucose;}
else if(x=='B')
goto End;
goto Temp;
Glucose:
delay (50);
x=Serial.read();
if (x=='S')
{
digitalWrite(3,LOW);
digitalWrite(2,LOW);
goto Glucose;
}
else if (x=='H') // 'H' STANDS FOR HIGH GLUCOSE LEVEL
{
for (int t=0;t<5000;t++)
{
digitalWrite(3,HIGH);
digitalWrite(2,LOW);
delay(1);
}
goto Stop;
}
else if(x=='V') // 'V' STANDS FOR VERY HIGH GLUCOSE LEVEL
{
for (int t=0;t<5000;t++)
{
digitalWrite(3,HIGH);
digitalWrite(2,LOW);
delay(1);
}
goto Stop;
}
else if (x=='R') // 'R' STANDS FOR REVERSE DIRECTION OF THE MOTOR
{
for (int t=0;t<20000;t++)
{
digitalWrite(2,HIGH);
digitalWrite(3,LOW);
delay(1);
}
goto Stop;
}
goto Glucose;
x=Serial.read();
if (x=='T')
{goto Temp;}
goto Glucose;
Stop:
digitalWrite(2,LOW);
digitalWrite(3,LOW);
x=Serial.read();
if (x=='T')
{goto Temp;}
else if(x=='G')
{goto Glucose;}
goto Stop;
End:
Serial.println("Program is ended intentionally...");
delay(20000);
x=Serial.read();
if (x=='T')
{goto Temp;}
else if(x=='G')
{goto Glucose;}
exit(0);
}
#include <eHealthDisplay.h>
void setup() {
eHealth.readGlucometer();
Serial.begin(115200);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
float temperature;
digitalWrite(3,LOW);
digitalWrite(2,LOW);
char x=Serial.read();
Temp: // LABEL FOR THE TEMPERATURE MEASUREMENTS
temperature = eHealth.getTemperature();
Serial.println(temperature);
delay (100);
x=Serial.read();
if (x=='G') // 'G' G STANDS FOR GLUCOSE, IT MATCHES WITH THE MATLAB CODE
{Serial.println("Switching to Glucose measuring...");
goto Glucose;}
else if(x=='B')
goto End;
goto Temp;
Glucose:
delay (50);
x=Serial.read();
if (x=='S')
{
digitalWrite(3,LOW);
digitalWrite(2,LOW);
goto Glucose;
}
else if (x=='H') // 'H' STANDS FOR HIGH GLUCOSE LEVEL
{
for (int t=0;t<5000;t++)
{
digitalWrite(3,HIGH);
digitalWrite(2,LOW);
delay(1);
}
goto Stop;
}
else if(x=='V') // 'V' STANDS FOR VERY HIGH GLUCOSE LEVEL
{
for (int t=0;t<5000;t++)
{
digitalWrite(3,HIGH);
digitalWrite(2,LOW);
delay(1);
}
goto Stop;
}
else if (x=='R') // 'R' STANDS FOR REVERSE DIRECTION OF THE MOTOR
{
for (int t=0;t<20000;t++)
{
digitalWrite(2,HIGH);
digitalWrite(3,LOW);
delay(1);
}
goto Stop;
}
goto Glucose;
x=Serial.read();
if (x=='T')
{goto Temp;}
goto Glucose;
Stop:
digitalWrite(2,LOW);
digitalWrite(3,LOW);
x=Serial.read();
if (x=='T')
{goto Temp;}
else if(x=='G')
{goto Glucose;}
goto Stop;
End:
Serial.println("Program is ended intentionally...");
delay(20000);
x=Serial.read();
if (x=='T')
{goto Temp;}
else if(x=='G')
{goto Glucose;}
exit(0);
}






0 comments:
Post a Comment