Control LED Segments from PC

Dear All,

I am doing a project for a donation to a hospital for their queue management system. Hospital guys wanted me to create 3 digit LED segments Display which is controllable via PC. What they required from me was to make them 3 digit Segments controllable via PC through network. I have made a demo but its not controllable via PC, at the moment, my arduino can just display the required numbers on segments.

I want to give them a URL as follows:
"http://192.168.1.150/segment1,segment2,segment3"

They can replace segmentx in their software to display the required number.

I have written the following code:

#define LATCH 2
#define CLK 4
#define DATA 8

byte digitOne[10]= {192, 249, 164, 176, 153, 146, 130, 248, 128, 152};
byte digitTwo[10]= {192, 249, 164, 176, 153, 146, 130, 248, 128, 152};
byte digitThree[10]= {192, 249, 164, 176, 153, 146, 130, 248, 128, 152};

void setup(){

pinMode(LATCH, OUTPUT);
pinMode(CLK, OUTPUT);
pinMode(DATA, OUTPUT);

}

void loop(){
d1(6,0,0);
}

void d1(byte x,byte y, byte z){
digitalWrite(LATCH, LOW);
shiftOut(DATA, CLK, MSBFIRST, digitThree[x]); // digitThree
shiftOut(DATA, CLK, MSBFIRST, digitTwo[y]); // digitTwo
shiftOut(DATA, CLK, MSBFIRST, digitOne[z]); // digitOne
digitalWrite(LATCH, HIGH);
delay(500);
}


The hardware job is done but im stuck with this URL thing, dont know how to do that. Can anyone help?

Regards,

Safiullah

The hardware job is done

No it isn't. You need to an an ethernet shield if you want to be able to communicate with the Arduino (as server). And, that is not a valid URL. Data in a URL is in name=value pairs, separated by &, with the first name=value pair following a ?.

safiullahtariq:
im stuck with this URL thing, dont know how to do that. Can anyone help?

Do you know how to write that sort of simple server code on a PC ?

I suspect it would be easier to learn web programming on your PC and then do the Arduino version when you know how the system should work.

You might consider using an Arduino Yun which has WiFi and Ethernet included and then you could do the web programming on the Linux side of the Yun. The Python Bottle web framework works nicely on the Yun.

...R

Thank you for your reply,

Well I have an Ethernet Shield.

What i dont know is how to write that code which you are referring you in your reply i.e. URL is in name=value pairs, separated by &, with the first name=value pair following a

PaulS:
You need to an an ethernet shield if you want to be able to communicate with the Arduino (as server). And, that is not a valid URL. Data in a URL is in name=value pairs, separated by &, with the first name=value pair following a ?.

What i dont know is how to write that code which you are referring you in your reply i.e. URL is in name=value pairs, separated by &, with the first name=value pair following a

Your Arduino will be a server. It will have some address assigned by you, that agrees with what the router that the ethernet shield is connected to will actually assign it. Lets say that that is 192.168.0,214.

You would fire up a browser, and type in http://192.168.0,214/?d100=3&d10=5&d1=8.

The browser takes that information, ans uses it to connect to the server at 192.168.0,214, and sends a GET request that looks like GET /?d100=3&d10=5&d1=8.

The Arduino needs to read, store, and, when the end of the request arrives, parse it, to decide what to do and how to reply.

Obviously, the reply should be something that the browser can use to display a meaningful response.

To my mind, that would be a form, containing three input fields, named d100, d10, and d1, and a submit button. The form would have an action associated with it that is simply "/".

The form would be returned, with empty fields (or with populated fields based on what is currently being displayed), when the user navigated to http://192.168.0,214/.

Your first step, since you seem to know nothing about client/server communications or html, is to go to HTML Tutorial, and learn about forms and what happens when the submit button is pressed.

Then you can make the Arduino send a form, where the submit button does nothing. You would simply print the requests.

When you understand the relationship between the fileds on the form and the information in the GET request, you can begin the process of making the Arduino actually use the data in the GET request.

Do NOT use Strings. You've been warned.

We're here to help you, not to write the code for you.

Thank you for your help.

I made the hardware of Segments, and gave the hospital's IT team (with my basic code), from that they got the idea and made the rest themselves....

Regards,

Safi