Telnet Led Control

Simple Telnet Client Led Control

//Telnet Led Contol

// Etherned and SPI
#include <SPI.h>
#include <Ethernet.h>

// I am using an green led for this project , you can obviously change this
int greenled = 9;

// MAC is software-set.
byte mac = { 0x90, 0xA2, 0xDA, 0x00, 0xE3, 0x5B };

// set your own network information as follows
IPAddress ip(129,173,97,17);
IPAddress gateway(129,173,96,1);
IPAddress subnet(255, 255, 254, 0);

EthernetServer telnetServer = EthernetServer(23);

void setup() {
pinMode(greenled, OUTPUT);

Serial.begin(9600);
Serial.print(“System Start”);

Ethernet.begin(mac, ip, gateway, subnet);

telnetServer.begin();
Serial.print(“Started the Servers\n”);

}

void loop() {

EthernetClient telnetClient = telnetServer.available();

if (telnetClient) {
boolean updatedState = false;

char telnetValue = telnetClient.read();

switch (telnetValue) {
case ‘0’:
updatedState = true;
digitalWrite (greenled, LOW);
break;
case ‘1’:
updatedState = true;
digitalWrite(greenled, HIGH);
break;

}
}
}