NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#include <SPI.h>
#include <Ethernet.h>

int kirmiziLED = 7;
int maviLED = 6;
int yesilLED = 5;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 100, 250 }; // ip in lan (that's what you need to use in your browser. ("192.168.1.178")
byte gateway[] = { 192, 168, 100, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port
String readString;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
pinMode(kirmiziLED, OUTPUT);
pinMode(yesilLED, OUTPUT);
pinMode(maviLED, OUTPUT);

// start the Ethernet connection and the server:
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
// Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}


void loop() {
// Create a client connection
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();

if (readString.length() < 100) {
//store characters to string
readString += c;
// Serial.print(c);
}

//if HTTP request has ended
if (c == 'n') {
// Serial.printchrln(readString); //print to serial monitor for debuging
client.println("HTTP/1.1 200 OK"); //send new page
client.println("Content-Type: text/html");
client.println();
client.println("<HTML>");
client.println("<HEAD>");
client.println("<meta name='apple-mobile-web-app-capable' content='yes' />");
client.println("<meta name='viewport' content='width=device-width, initial-scale=1' />");


client.println("<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' />");
client.println("<TITLE> METROMEDYA LED DASHBOARD </TITLE>");
client.println("</HEAD>");

client.println("<BODY>");
client.println("<H1>METROMEDYA LED DASHBOARD</H1>");
client.println("<hr />");
client.println("<br />");
client.println("<table>");
client.println("<tr>");
client.println("<td>");
client.println("<a href="/?yesil" target="_self">YESIL</a>");
client.println("</td>");
client.println("<td>");
client.println("<a href="/?sari"" target="_parent">SARI</a>");
client.println("</td>");
client.println("<td>");
client.println("<a href="/?kirmizi"" target="_parent">KIRMIZI</a>");
client.println("</td>");
client.println("<td>");
client.println("<a href="/?mavi"">MAVI</a>");
client.println("</td>");
client.println("<td>");
client.println("<a href="/?beyaz"">BEYAZ</a>");
client.println("</td>");
client.println("<td>");
// client.println("<a href="/?disko"">DISKOO</a>");
client.println("</td>");
client.println("</tr>");
client.println("</table>");
client.println("<br />");
client.println("<br />");
client.println("</BODY>");
client.println("</HTML>");

delay(1);
//stopping client
client.stop();
//controls the Arduino if you press the buttons
if (readString.indexOf("?yesil") > 0) {
digitalWrite(yesilLED, HIGH);
digitalWrite(kirmiziLED, LOW);
digitalWrite(maviLED, LOW);

// Serial.println(readString.indexOf("?yesil") + " yesil led acildi"); //print to serial monitor for debuging
}
if (readString.indexOf("?sari") > 0) {
digitalWrite(yesilLED, HIGH);
digitalWrite(kirmiziLED, HIGH);
digitalWrite(maviLED, LOW);

// Serial.println(readString.indexOf("?yesil") + " yesil led acildi"); //print to serial monitor for debuging
}
if (readString.indexOf("?kirmizi") > 0) {
digitalWrite(kirmiziLED, HIGH);
digitalWrite(yesilLED, LOW);
digitalWrite(maviLED, LOW);
//
// Serial.println(readString.indexOf("?kirmizi") + "kirmizi durumu"); //print to serial monitor for debuging

}

if (readString.indexOf("?mavi") > 0) {
digitalWrite(kirmiziLED, LOW);
digitalWrite(yesilLED, LOW);
digitalWrite(maviLED, HIGH);

// Serial.println(readString.indexOf("?mavi") + "mavi durumu" ); //print to serial monitor for debuging

}

if (readString.indexOf("?beyaz") > 0) {
digitalWrite(maviLED, HIGH);
digitalWrite(kirmiziLED, HIGH);
digitalWrite(yesilLED, HIGH);
// Serial.println(readString.indexOf("?yesil") + 'durumu'); //print to serial monitor for debuging
//
// Serial.println(readString.indexOf("?kirmizi") + 'durumu'); //print to serial monitor for debuging
//
// Serial.println(readString.indexOf("?mavi") + 'durumu'); //print to serial monitor for debuging
}
// if (readString.indexOf("?disko") > 0) {
// digitalWrite(maviLED, HIGH);
// delay(1);
// digitalWrite(kirmiziLED, LOW);
// delay(1);
//
// digitalWrite(yesilLED, HIGH);
// delay(1);
//
//
// }



readString = "";

}
}
}
}
}
Reply
Forward
Fwd:
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.