Appendix A Source Code A. Arduino Code
Appendix A Source Code A. Arduino Code
SOURCE CODE
A. ARDUINO CODE
#include "WiFiEsp.h"
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
#endif
WiFiEspServer server(80);
46
RingBuffer buf(8);
void setup()
Serial.begin(115200);
Serial1.begin(9600);
WiFi.init(&Serial1);
pinMode(2,OUTPUT);//for Buzzer
47
//Condition: if WiFi Shield is Present
if (WiFi.status() == WL_NO_SHIELD) {
digitalWrite(3, LOW);
// don't continue
while (true);
Serial.println(ssid);
48
digitalWrite(3, HIGH);
printWifiStatus();
server.begin();
void loop()
if (client) {
Serial.println("New client");
49
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
buf.push(c);
if (buf.endsWith("GET /H")) {
Serial.println("Confirmed Call");
digitalWrite(2, HIGH);
delay(3000);
// "\r\n"
// character) and the line is blank, the http request has ended,
50
Serial.println("Sending response");
client.print(
response
"\r\n");
client.print("<!DOCTYPE HTML>\r\n");
client.print("<html>\r\n");
client.print("<h1></h1></p>\r\n");
client.println("<br>");
51
int sensorValue3 = analogRead(A2);
client.print("<br>\r\n");
client.println("<p id='date'></p>");
client.println("<script>");
client.println("document.getElementById('date').innerHTML = Date();");
client.println("</script>");
digitalWrite(4, HIGH);
delay(5000);
digitalWrite(4, LOW);
client.print("<br>\r\n");
client.print("</html>\r\n");
52
}
client.print("<br>\r\n");
client.println("<p id='date'></p>");
client.println("<script>");
client.println("document.getElementById('date').innerHTML = Date();");
client.println("</script>");
digitalWrite(4, HIGH);
delay(5000);
digitalWrite(4, LOW);
client.print("<br>\r\n");
client.print("</html>\r\n");
client.print("<br>\r\n");
53
client.print("JRMSU main Campus ");
client.println("<p id='date'></p>");
client.println("<script>");
client.println("document.getElementById('date').innerHTML = Date();");
client.println("</script>");
digitalWrite(4, HIGH);
delay(5000);
digitalWrite(4, LOW);
client.print("<br>\r\n");
client.print("</html>\r\n");
client.print("<br>\r\n");
client.print("NEED AMBULANCE");
client.println("<p id='date'></p>");
54
client.println("<script>");
client.println("document.getElementById('date').innerHTML = Date();");
client.println("</script>");
digitalWrite(4, HIGH);
delay(5000);
digitalWrite(4, LOW);
client.print("<br>\r\n");
client.print("</html>\r\n");
break;
else if (c != '\r') {
currentLineIsBlank = false;
55
delay(10);
client.stop();
Serial.println("Client disconnected");
void printWifiStatus()
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
IPAddress ip = WiFi.localIP();
56
Serial.println(ip);
Serial.println();
Serial.println(ip);
Serial.println();
Adodc1.Refresh
57
If (Adodc1.Recordset.EOF = False) Then
Adodc1.Recordset.Fields("level")) Then
web.Show
web.Label13.Caption = Text2.Text
Else
web.File.Enabled = False
web.PrintReport.Enabled = False
End If
Me.Hide
Text2.Text = ""
Text3.Text = ""
Text8.Text = ""
Else
58
Text2.Text = ""
Text3.Text = ""
Text8.Text = ""
Text2.SetFocus
End If
Else
Text2.Text = ""
Text3.Text = ""
Text8.Text = ""
Text2.SetFocus
End If
End Sub
59
End
End If
web.Show
End If
End Sub
Unload Me
60
frmAbout.Show
End Sub
Unload Me
frmUserAcct.Show
End Sub
WebBrowser1.Navigate ("http://192.168.8.101")
End Sub
Adodc2.Recordset.AddNew
61
Adodc2.Recordset.Fields("username") = Label13.Caption
Adodc2.Recordset.Fields("date") = Label5.Caption
Adodc2.Recordset.Fields("time") = Label16.Caption
Adodc2.Recordset.Fields("department") = Label14.Caption
Adodc2.Recordset.Fields("report") = "Combo5.text"
End Sub
WebBrowser5.Navigate ("http://192.168.8.105")
End Sub
Adodc2.Recordset.AddNew
Adodc2.Recordset.Fields("username") = Label13.Caption
Adodc2.Recordset.Fields("date") = Label5.Caption
Adodc2.Recordset.Fields("time") = Label16.Caption
62
Adodc2.Recordset.Fields("department") = Label14.Caption
Adodc2.Recordset.Fields("report") = "Combo1.text"
End Sub
Adodc2.Recordset.AddNew
Adodc2.Recordset.Fields("username") = Label13.Caption
Adodc2.Recordset.Fields("date") = Label5.Caption
Adodc2.Recordset.Fields("time") = Label16.Caption
Adodc2.Recordset.Fields("department") = Label14.Caption
Adodc2.Recordset.Fields("report") = "Combo2.text"
End Sub
WebBrowser2.Navigate ("http://192.168.8.102")
End Sub
63
Private Sub Command5_Click()
Unload Me
frmLogin.Show
End Sub
Adodc2.Recordset.AddNew
Adodc2.Recordset.Fields("username") = Label13.Caption
Adodc2.Recordset.Fields("date") = Label5.Caption
Adodc2.Recordset.Fields("time") = Label16.Caption
Adodc2.Recordset.Fields("department") = Label14.Caption
Adodc2.Recordset.Fields("report") = "Combo3.text"
End Sub
64
WebBrowser3.Navigate ("http://192.168.8.103")
End Sub
Adodc2.Recordset.AddNew
Adodc2.Recordset.Fields("username") = Label13.Caption
Adodc2.Recordset.Fields("date") = Label5.Caption
Adodc2.Recordset.Fields("time") = Label16.Caption
Adodc2.Recordset.Fields("department") = Label14.Caption
Adodc2.Recordset.Fields("report") = "Combo4.text"
End Sub
End Sub
65
Private Sub mnubrown_Click()
End Sub
End Sub
End Sub
66
web.BackColor = RGB(0, 255, 0)
End Sub
End Sub
web.BackColor = RGB(255, 0, 0)
End Sub
67
End Sub
End Sub
web.Width = 5000
web.Height = 5000
WebBrowser1.Width = 5000
WebBrowser1.Height = 5000
End Sub
web.Width = 7000
68
web.Height = 7000
WebBrowser1.Width = 7000
WebBrowser1.Height = 7000
End Sub
web.Width = 9000
web.Height = 9000
WebBrowser1.Width = 9000
WebBrowser1.Height = 9000
End Sub
web.Width = 12000
web.Height = 12000
WebBrowser1.Width = 12000
69
WebBrowser1.Height = 12000
End Sub
web.Width = 15000
web.Height = 15000
WebBrowser1.Width = 15000
WebBrowser1.Height = 15000
End Sub
End Sub
70
End Sub
WebBrowser4.Navigate ("http://192.168.8.104")
End Sub
End Sub
Me.Hide
frmReports.Show
DataReport1.Sections("Section1").Controls("text1").DataField = "username"
DataReport1.Sections("Section1").Controls("text2").DataField = "department"
71
DataReport1.Sections("Section1").Controls("text3").DataField = "date"
DataReport1.Sections("Section1").Controls("Text4").DataField = "time"
DataReport1.Sections("Section1").Controls("Text5").DataField = "report"
DataReport1.Show
End Sub
End Sub
Today = Now
End Sub
72
Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Text1.Text = (WebBrowser1.LocationURL)
Text2.Text = (WebBrowser2.LocationURL)
Text3.Text = (WebBrowser2.LocationURL)
Text4.Text = (WebBrowser2.LocationURL)
'web.Caption = (WebBrowser1.LocationName)
End Sub
73
msg1 = MsgBox("are you sure you want to delete this?", vbOKCancel, "delete")
Adodc1.Recordset.Delete
End If
Adodc1.Refresh
End If
End Sub
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("username") = Text4.Text
Adodc1.Recordset.Fields("password") = Text5.Text
Adodc1.Recordset.Fields("department") = Text6.Text
Adodc1.Recordset.Fields("level") = Text9.Text
Text4.Text = "Username"
Text5.Text = "Password"
74
Text6.Text = "Department"
Text9.Text = "Level"
Text5.PasswordChar = ""
Text4.SetFocus
End Sub
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text9.Text = ""
Text7.Text = ""
End If
Unload Me
web.Show
75
If msg1 = vbCancel Then
End If
End Sub
Adodc1.Refresh
End Sub
Else
Adodc1.Recordset.Fields("username") = Text4.Text
Adodc1.Recordset.Fields("password") = Text5.Text
76
Adodc1.Recordset.Fields("department") = Text6.Text
Adodc1.Recordset.Fields("level") = Text9.Text
Adodc1.Recordset.Update
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text9.Text = ""
Text4.SetFocus
End If
End Sub
Text4.Text = Adodc1.Recordset.Fields("username")
Text5.Text = Adodc1.Recordset.Fields("password")
Text6.Text = Adodc1.Recordset.Fields("department")
Text9.Text = Adodc1.Recordset.Fields("level")
Command9.Enabled = True
77
Command11.Enabled = True
Command3.Enabled = False
End Sub
End Sub
End Sub
78
Private Sub Command1_Click()
Unload Me
web.Show
End Sub
End Sub
79