Oke gas dah lama ngga main arduino, mumpung libur di harikemerdekaan RI yang ke 71 ini nyempetin untuk maen maen arduino … kebetulan ada ethernet modul ENC28J60, akhirnya dibuat deh mini web servernya …
untuk library masih yang lama dan master libraryna bisa di download disini . ada beberapa point yang penting, yaitu mengonekan ethernet modul dengan arduinonya … berikut tabelnya
EtherCard Arduino UNO
VCC 3.3V
GND GND
SCK Pin 13
SO Pin 12
SI Pin 11
CS Pin 8
setting menggunakan statik, dan ip jangan lupa menggunakan koma bukan titik.
contoh skript example yang sedikit dirubah
===================================================================
// Present a “Will be back soon web page”, as stand-in webserver.
// 2011-01-30 http://opensource.org/licenses/mit-license.php
#include
#define STATIC 1 // set to 1 to disable DHCP (adjust myip/gwip values below)
#if STATIC
// ethernet interface ip address
static byte myip[] = { 172,16,15,90 };
// gateway ip address
static byte gwip[] = { 172,16,15,89 };
#endif
// ethernet mac address – must be unique on your network
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[500]; // tcp/ip send and receive buffer
const char page[] PROGMEM =
“HTTP/1.0 503 Service Unavailablern”
“Content-Type: text/htmlrn”
“Retry-After: 600rn”
“rn”
“”
“
“
“Service Temporarily Unavailable”
“
“
“”
“
Arduino Mini Server 172.16.15.90 belum digunakan
“
“
“
“Server ini masi dalam kondisi offline.
“
“Silahkan kembali nanti … “
“
gdsapp network support by tukangsapu.net .”
“
“
“
“
“
“
;
void setup(){
Serial.begin(57600);
Serial.println(“n[backSoon]”);
if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( “Failed to access Ethernet controller”);
#if STATIC
ether.staticSetup(myip, gwip);
#else
if (!ether.dhcpSetup())
Serial.println(“DHCP failed”);
#endif
ether.printIp(“IP: “, ether.myip);
ether.printIp(“GW: “, ether.gwip);
ether.printIp(“DNS: “, ether.dnsip);
}
void loop(){
// wait for an incoming TCP packet, but ignore its contents
if (ether.packetLoop(ether.packetReceive())) {
memcpy_P(ether.tcpOffset(), page, sizeof page);
ether.httpServerReply(sizeof page – 1);
}
}
============================================================
so gas … gampang kan … tinggal kita kembangkan aja kegunaanya untuk apa … video youtube nya nyusul lagi ngambek neh hp ngga konak ke pc hehhe 😀
modulnya enc28j60
hasilnya seperti ini …
Semoga bermanfaat
Reff :
http://jeelabs.org/pub/docs/ethercard/