Go Down

Topic: Wlan-Wifi communication beetween 2 Arduinos+Redfly (Read 635 times) previous topic - next topic

Mar 04, 2013, 10:26 am Last Edit: Mar 10, 2013, 10:42 am by MichelNimes Reason: 1
Hello,

AdhocTest https://github.com/watterott/RedFly-Shield/blob/master/src/libraries/RedFly/examples/AdhocTest/AdhocTest.ino
and InfrastructureTest https://github.com/watterott/RedFly-Shield/blob/master/src/libraries/RedFly/examples/InfrastructureTest/InfrastructureTest.ino
are very useful new exemples for Wifi-Wlan Redfly shield, by Watterott, for those -like me- who try to directly talk from an Arduino to another one, without passing through any computer.
These exemples describe how to send one digital info (for instance High/Low state of a switch), from one Arduino to another.
However, could somebody explain how to program what follows -or send here some nice tuto links-?

1°) - Send various H/L infos, from various digital sensors -like switches-, from one card, to their correspondent receivers on the other card, identified by their pin number from D4 to D13.
In my case, the remote release of reading various sound files on Adafruit Waveshield http://www.ladyada.net/make/waveshield/

2°) - Same question, but with more complex analog infos -for instance resulting from a potentiometer-, in my case sent to an engine's speed variator on the other card, through Adafruit's MotorShield http://www.ladyada.net/make/mshield/
What I more similar found, was http://arduino.cc/en/Tutorial/Graph, but through interpretation of Serial by Processing ...thus a computer...

3°) - Below is the actual problem's state, "switch" side (Client card):

Code: [Select]

void loop()
{
 uint8_t c1;
   uint8_t c2;
     uint8_t c3;
 unsigned long ms = millis();

   if(!clientvoix.connected())
   {
     clientvoix.stop();
     clientvoix.connect();
   }
   
   else if(((ms-last_time) > 100))
   
   {
     last_time = ms;
     
     c1 = digitalRead(BP1); // BP1 is 1st switch's name, BP2 etc
     if(c1 != last_state1)
     {
       last_state1 = c1;
       clientvoix.write(c1);
       }
       
        c2 = digitalRead(BP2);
     if(c2 != last_state2)
     {
       last_state2 = c2;
       clientvoix.write(c2);

/*
... But I would like this to send its own H/L info of BP2 switch, such as (pin5, HIGH) and not only HIGH, sent to the right pin (pin5) of the other (server) Arduino. What's to be done?
*/
       }
       
        c3 = digitalRead(BP3);
     if(c3 != last_state3)
     {
       last_state3 = c3;
       clientvoix.write(c3);
// same problem...
       }
   }
}


Thanks... I am certain that informations could help many people who do the best they can for programming ...that means no miracles!
www.michelglaize.com


zoomkat

I can't speak to the specific equipment you are using, but below is some discussion on communicating between two arduinos via ethernet. There is also some "chat" code in the IDE examples. The wifi shields seem to need more development before becomming fairly easy to use.

http://arduino.cc/forum/index.php/topic,152078.0.html
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Go Up