Pages: [1]   Go Down
Author Topic: Arduino Server now in Beta Testing..  (Read 554 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Faraday Member
**
Karma: 30
Posts: 2528
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been very busy, download the zip, read the readme.txt

I've included all the source code to everything, my Server the client, and the arduino code, ideally some kind of header (include .h/cpp) would be good
to send and recv..

To debug it, disable the client (as only 1 program can share the com port) by simply closing it and use the Arduino IDE to make sure your board
is working.. when you're happy

run ArduinoClient.exe (sorry Windows only until someone who likes this is able to code a client in linux) the source code is all included.
(unless you wish to host, then you can run the server as well, but click on "loopback" so that it reconnects to 127.0.0.1 or it will connect
to myarduino.info on port 1234)

Step 1. Change the com port to yours, or change the system com port to com 4.
Step 2. Click on the connect button, then click on the Establish Connection (over com port, if it errors make sure Arduino is no in use on that port)
Step 3. Click on the Send button [pin2]

you if you have an LED connected to pin2 on your arduino, the light should light up, not only that, but my LED here (if you connected) will also light


//Serial.println("pin3");
//Serial.println("reset"); //switches off all the pins

from Arduino, just send it over the com port, the client then relays it to the server on and forward to everyone else.


I have mine on now, so if anyone tries this, i'll see my LED's go on and OFF, i've not put any effort into the server yet, eventually
i'll be able to have it so you can forward on packets to certain arduino's and not others, moderation, boot them off the server
etc etc..

right now, it's proof of concept smiley - and a lot of "ugh" moments for me today lol... so if anyone tries it, switch on my LED's
they're all off right now smiley-razz

* Delphi Arduino Server and Client SourceCode.zip (372.35 KB - downloaded 9 times.)
Logged

Offline Offline
Faraday Member
**
Karma: 30
Posts: 2528
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So all you need to get started is an arduino some led's 2 - 7 and the client, i have mine on now, so go ahead, switch on any
of the pins from 2 -  7 from the client or in code.

Code:
void setup()
{
  Serial.begin( 9600 );
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);  
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);  
  pinMode(7,OUTPUT);
  ResetPins;
  
//7 for now... (this source code is just how i think it's done
//if you can do better feel free.. remember you can send
//pin1 or /pin85 it just gets relayed to all the other
//arduino boards connected, so how you develop
//the protocol is up to you, all i have to do is server
//management.. or anyone else who hosts a server.

//simply connect some ids from pins 2 to 7 (not tx/recv 0/1)

  
}

void loop()
{
 String cstr;
 char c;
 int b = 0;
 int pin,n = 0;
 boolean pincheck;
 int pinstate;

cstr="";
while (Serial.available())
 {
  c = Serial.read();

  if (c=='\n' || c=='\r')  break;
  cstr=cstr+c;
//turn them off
 }

  //Serial.println(cstr);

pinstate=HIGH;
if (cstr=="reset")  ResetPins();
if (cstr=="pin2")  digitalWrite(2,pinstate);
if (cstr=="pin3")  digitalWrite(3,pinstate);
if (cstr=="pin4")  digitalWrite(4,pinstate);
if (cstr=="pin5")  digitalWrite(5,pinstate);
if (cstr=="pin6")  digitalWrite(6,pinstate);
if (cstr=="pin7")  digitalWrite(7,pinstate);

pinstate=LOW;
if (cstr=="pinl2")  digitalWrite(2,pinstate);
if (cstr=="pinl3")  digitalWrite(3,pinstate);
if (cstr=="pinl4")  digitalWrite(4,pinstate);
if (cstr=="pinl5")  digitalWrite(5,pinstate);
if (cstr=="pinl6")  digitalWrite(6,pinstate);
if (cstr=="pinl7")  digitalWrite(7,pinstate);
 
 delay(500);
 
}

void ResetPins()
{
  digitalWrite(2,LOW);
  digitalWrite(3,LOW);
  digitalWrite(4,LOW);
  digitalWrite(5,LOW);
  digitalWrite(6,LOW);
  digitalWrite(7,LOW);
}              
    
//now turn them on based on event


  
  //s contains info from server, so all we do is act on it.
  //to debug, turn off the client/arduino server so you can
  //use ArduinoClient 1.0 to view the data you send here with

 //for(n=3; n>=7; n++)
 // {
 //  Serial.print("pin");
 //  Serial.print(n);
 //  Serial.println();
 //  delay(2000);
 // }
  
  

Logged

Offline Offline
Faraday Member
**
Karma: 30
Posts: 2528
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

someone just switched on pins 2 and 4 smiley-razz

nice green and blue smiley-razz
Logged

Offline Offline
Faraday Member
**
Karma: 30
Posts: 2528
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

from the client click on [Send] from the client
and my Pin2 will come on...

to make pin2 come on yours, click on "Establish connection" on the correct port.
Logged

Offline Offline
Faraday Member
**
Karma: 30
Posts: 2528
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://arduino.cc/forum/index.php/topic,102671.0.html

So it's a continuation of that thread, but now the ardino code needs to be passed to someone who knows what they're doing to make some kind
of header/object to do this, remember to close arduino/com port before trying to connect in the ArduinoClient.exe  - source code included if you're
not sure what's going on...
Logged

Pages: [1]   Go Up
Jump to: