1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
Lampiran
1. LAMPIRAN
1. Kodingan pada Arduino
const int buttonPin1 = 14;
// the number of the pushbutton
pin
const int buttonPin2 = 15;
// the number of the pushbutton
pin
const int buttonPin3 = 16;
// the number of the pushbutton
pin
const int buttonPin4 = 17;
// the number of the pushbutton
pin
const int buttonPin5 = 18;
// the number of the pushbutton
pin
const int ledPin1 = 12; //
the number of the LED pin
const int ledPin2 = 11; //
const int ledPin3 = 10; //
the number of the LED pin
const int ledPin4 = 9; //
// variables will change:
int sensor1 = 0; //
variable for reading the
pushbutton status
int sensor2 = 0; //
variable for reading the
pushbutton status
int sensor3 = 0; //
variable for reading the
pushbutton status
int sensor4 = 0; //
variable for reading the
pushbutton status
int sensor_ir = 0; //
variable for reading the
pushbutton status
int AWAL=0;
int REAL=0;
int k1=0;
int k2=0;
int k3=0;
int k4=0;
void setup() {
Serial.begin(9600);
// initialize the LED pin as
an output:
pinMode(ledPin1,
OUTPUT);
pinMode(ledPin2,
OUTPUT);
pinMode(ledPin3,
OUTPUT);
pinMode(ledPin4,
OUTPUT);
// initialize the pushbutton
pin as an input:
pinMode(buttonPin1,
INPUT);
pinMode(buttonPin2,
INPUT);
pinMode(buttonPin3,
INPUT);
pinMode(buttonPin4,
INPUT);
pinMode(buttonPin5,
INPUT);
//inputString.reserve(200);
}
void loop(){
sensor1 =
digitalRead(buttonPin1);
sensor2 =
digitalRead(buttonPin2);
sensor3 =
digitalRead(buttonPin3);
sensor4 =
digitalRead(buttonPin4);
sensor_ir =
digitalRead(buttonPin5);
5. Private Sub Form_Click()
Call baca
End Sub
Private Sub Form_Load()
status = False
mydata1 = "A"
mydata2 = "a"
End Sub
Private Sub ljam_Click()
Call baca
End Sub
Sub baca()
Dim com As String
On Error GoTo salah
If status = False Then
com =
InputBox("Masukkan Port Arduino", "Input
COM", "4")
If MSComm.PortOpen =
False Then
MSComm.CommPort =
Val(com)
MSComm.PortOpen =
True
MsgBox "koneksi
berhasil....", vbInformation + vbOKOnly,
"sukses"
End If
tmr.Enabled = True
status = True
Me.WindowState = 1
Else
Dim dis As String
dis = MsgBox("anda ingin
menutup koneksi?", vbQuestion + vbYesNo,
"Diskoneksi")
If dis = vbYes Then
If MSComm.PortOpen =
True Then
MSComm.PortOpen =
False
End If
tmr.Enabled = False
status = False
MsgBox "DisKoneksi
Berhasil", vbInformation + vbOKOnly,
"Diskonek"
End If
End If
Exit Sub
salah:
MsgBox "Koneksi
Gagal...cek koneksi port name Anda",
vbInformation + vbOKOnly, "Cek COMM"
End Sub
Private Sub tmr_Timer()
Dim buff As Variant
Dim jam, mnt, detik As
String
jam = Format(Time, "hh")
6. mnt = Format(Time, "mm")
dtk = Format(Time, "ss")
If Len(jam) < 2 Then
jam = "0" & jam
End If
If Len(mnt) < 2 Then
mnt = "0" & mnt
End If
If Len(dtk) < 2 Then
dtk = "0" & dtk
End If
ljam.Caption = jam & ":" &
mnt & ":" & dtk & " WIB"
ljam.ForeColor =
QBColor(Rnd * 13)
If MSComm.PortOpen =
True Then
buff = MSComm.Input
buff = Trim(buff)
mydata1 = buff
If mydata1 = mydata2
Then
'diam saja
Else
Me.Caption = ".:" &
mydata1 & ":."
myata2 = mydata1
If InStr(buff, "A") > 0
Then
simpan ("A")
ElseIf InStr(buff, "a") >
0 Then
simpan ("a")
ElseIf InStr(buff, "B")
> 0 Then
simpan ("B")
ElseIf InStr(buff, "b") >
0 Then
simpan ("b")
ElseIf InStr(buff, "C")
> 0 Then
simpan ("C")
ElseIf InStr(buff, "c") >
0 Then
simpan ("c")
ElseIf InStr(buff, "D")
> 0 Then
simpan ("D")
ElseIf InStr(buff, "d") >
0 Then
simpan ("d")
End If
End If
End If
End Sub
Sub simpan(ByVal data As
String)
Dim artidata, ket As String
If data = "A" Then
artidata = "Siaga 4"
ket = "Arah Turun"
ElseIf data = "a" Then
artidata = "Siaga 4"
7. ket = "Arah Naik"
ElseIf data = "B" Then
artidata = "Siaga 3"
ket = "Arah Turun"
ElseIf data = "b" Then
artidata = "Siaga 3"
ket = "Arah Naik"
ElseIf data = "C" Then
artidata = "Siaga 2"
ket = "Arah Turun"
ElseIf data = "c" Then
artidata = "Siaga 2"
ket = "Arah Naik"
ElseIf data = "D" Then
artidata = "Siaga 1"
ket = "Arah Turun"
ElseIf data = "d" Then
artidata = "Siaga 1"
ket = "Arah Naik"
End If
adoproses.RecordSource =
"select * from tb_pintu1"
adoproses.Refresh
With adoproses.Recordset
.AddNew
!inisial = data
!siaga = artidata
!tanggal = Format(Date,
"yyyy-mm-dd")
!jam = Format(Time,
"hh:mm:ss")
!keterangan = ket
.Update
End With
adoproses.Refresh
adoproses2.RecordSource =
"select * from tb_pintu2"
adoproses2.Refresh
With adoproses2.Recordset
.AddNew
!inisial = data
!siaga = artidata
!tanggal = Format(Date,
"yyyy-mm-dd")
!jam = Format(Time,
"hh:mm:ss")
!keterangan = ket
.Update
End With
adoproses2.Refresh
End Sub