Coding
Coding
Coding
php
<html>
<head>
<meta charset="UTF-8">
<title>Monitor Petugas</title>
<style>
h3{
text-align:center;}
table {
border-collapse:collapse;
border-spacing:0;
font-family:Arial, sans-serif;
font-size:16px;
padding-left:300px;
margin:auto; }
table th {
font-weight:bold;
padding:10px;
color:#fff;
background-color:#2A72BA;
table td {
padding:10px;
text-align:center; }
tr:nth-child(even) {
background-color: #DFEBF8; }
<body style="background-image:url(monitor-
petugas.000webhostapp.com/background.jpg)">
</style>
</head>
<body backgorund="monitor-petugas.000webhostapp.com/background.jpg">
<table>
<tr>
</tr>
<tr>
</tr>
</table>
</html>
#include <NewPing.h>
#define TRIGGER_PIN 5
#define ECHO_PIN 6
#define MAX_DISTANCE 50
// pengaturan ethernet
#include <EtherCard.h>
byte Ethernet::buffer[700];
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 4
#define RST_PIN 3
Serial.println(">>>");
Ethernet::buffer[off + 300] = 0;
Serial.println("...");
void setup () {
// setup ethernet
Serial.begin(57600);
Serial.println(F("\n[webClient]"));
//setup rfid
SPI.begin();
mfrc522.PCD_Init();
if (!ether.dhcpSetup())
Serial.println(F("DHCP failed"));
#if 1
if (!ether.dnsLookup(website))
Serial.println("DNS failed");
#elif 2
ether.parseIp(ether.hisip, websiteIP);
#else
#endif
void loop () {
ether.packetLoop(ether.packetReceive());
ether.packetLoop(ether.packetReceive());
Serial.println(jarak);
ether.browseUrl(PSTR("/sampah/write.php?kode=JKT01&status=Penuh&lokasi=maps.google.com/maps
?q=-6.248319,106.970530"), "", website, my_callback);;
konSampah = "PENUH";
String kodeKartu;
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
mfrc522.PICC_HaltA();
kodeKartu.trim();
kodeKartu.toUpperCase();
Serial.println(kodeKartu);
if (kodeKartu == "E2C290AB")
ether.browseUrl(PSTR("/petugas/write.php?nama=Aras&kode=E2C290AB&lokasi=maps.google.com/ma
ps?q=-6.248319,106.970530"), "", website, my_callback);
ether.packetLoop(ether.packetReceive());
ether.packetLoop(ether.packetReceive());
kodeKartu = "";
konSampah = "KOSONG";
#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>
char message[MESSAGE_LENGTH];
int messageIndex = 0;
char MESSAGE[300];
char lat[12];
char lon[12];
char wspeed[12];
char phone[16];
char datetime[24];
#define PIN_TX 52
#define PIN_RX 53
void sendSMS();
void getGPS();
void readSMS();
void setup()
mySerial.begin(9600);
Serial.begin(9600);
while (!sim808.init())
delay(1000);
delay(3000);
void loop()
messageIndex = sim808.isSMSunread();
if (messageIndex > 0)
Serial.println(cek);
if (cek == "OK") {
readSMS();
getGPS();
sendSMS();
sim808.detachGPS();
}
Serial.println("Please send SMS message to me!");
void readSMS()
Serial.print("messageIndex: ");
Serial.println(messageIndex);
sim808.deleteSMS(messageIndex);
Serial.println(phone);
Serial.print("Datetime: ");
Serial.println(datetime);
Serial.println(message);
void getGPS()
while (!sim808.attachGPS())
{
Serial.println("Open the GPS power failure");
delay(1000);
delay(3000);
while (!sim808.getGPS())
Serial.print(sim808.GPSdata.year);
Serial.print("/");
Serial.print(sim808.GPSdata.month);
Serial.print("/");
Serial.print(sim808.GPSdata.day);
Serial.print(" ");
Serial.print(sim808.GPSdata.hour);
Serial.print(":");
Serial.print(sim808.GPSdata.minute);
Serial.print(":");
Serial.print(sim808.GPSdata.second);
Serial.print(":");
Serial.println(sim808.GPSdata.centisecond);
Serial.print("latitude :");
Serial.println(sim808.GPSdata.lat);
Serial.print("longitude :");
Serial.println(sim808.GPSdata.lon);
Serial.print("speed_kph :");
Serial.println(sim808.GPSdata.speed_kph);
Serial.print("heading :");
Serial.println(sim808.GPSdata.heading);
Serial.println();
float la = sim808.GPSdata.lat;
float lo = sim808.GPSdata.lon;
float ws = sim808.GPSdata.speed_kph;
dtostrf(la, 4, 6, lat); //put float value of la into char array of lat. 4 = number of digits before decimal
sign. 6 = number of digits after the decimal sign.
void sendSMS()
Serial.println(phone);
sim808.sendSMS(phone, MESSAGE);