Go Down

Topic: Variable conversion (Solved) (Read 14535 times) previous topic - next topic

Trixi

No prb of course - Babies rulez  :D (thank god my kids are adults now  8))
Dum spiro, spero - if you find my posting helpful, please click my Karma :)

Frederic_Plante

#16
Sep 10, 2013, 09:38 pm Last Edit: Sep 10, 2013, 09:41 pm by Frédéric_Plante Reason: 1
Here, this is the wifi server  that can be found at: http://arduino.cc/en/Tutorial/WiFiChatServer

Code: [Select]
#include <SPI.h>
#include <WiFi.h>

char ssid[] = "yourNetwork"; //  your network SSID (name)
char pass[] = "secretPassword";    // your network password (use for WPA, or use as key for WEP)

int keyIndex = 0;            // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;

WiFiServer server(23);

boolean alreadyConnected = false; // whether or not the client was connected previously

void setup() {
 //Initialize serial and wait for port to open:
 Serial.begin(9600);
 while (!Serial) {
   ; // wait for serial port to connect. Needed for Leonardo only
 }
 
 // check for the presence of the shield:
 if (WiFi.status() == WL_NO_SHIELD) {
   Serial.println("WiFi shield not present");
   // don't continue:
   while(true);
 }
 
 // attempt to connect to Wifi network:
 while ( status != WL_CONNECTED) {
   Serial.print("Attempting to connect to SSID: ");
   Serial.println(ssid);
   // Connect to WPA/WPA2 network. Change this line if using open or WEP network:    
   status = WiFi.begin(ssid, pass);

   // wait 10 seconds for connection:
   delay(10000);
 }
 // start the server:
 server.begin();
 // you're connected now, so print out the status:
 printWifiStatus();
}


void loop() {
 // wait for a new client:
 WiFiClient client = server.available();


 // when the client sends the first byte, say hello:
 if (client) {
   if (!alreadyConnected) {
     // clead out the input buffer:
     client.flush();    
     Serial.println("We have a new client");
     client.println("Hello, client!");
     alreadyConnected = true;
   }

   if (client.available() > 0) {
     // read the bytes incoming from the client:
     char thisChar = client.read();
     // echo the bytes back to the client:
     server.write(thisChar);
     // echo the bytes to the server as well:
     Serial.write(thisChar);
   }
 }
}


void printWifiStatus() {
 // print the SSID of the network you're attached to:
 Serial.print("SSID: ");
 Serial.println(WiFi.SSID());

 // print your WiFi shield's IP address:
 IPAddress ip = WiFi.localIP();
 Serial.print("IP Address: ");
 Serial.println(ip);

 // print the received signal strength:
 long rssi = WiFi.RSSI();
 Serial.print("signal strength (RSSI):");
 Serial.print(rssi);
 Serial.println(" dBm");
}



Try it, tel me if it work and how mutch memory it use. Then post it back with the modification that you made to make it work. From there ill add some stuff to make it talk to the NFR module.
As we fight our way northward into the great unknown, only that one thing remains certain...

Trixi

Thx, i will try it -but how to connect the NFR to the SPI ?
Like described in the MIRF-Demo ?
Dum spiro, spero - if you find my posting helpful, please click my Karma :)

Frederic_Plante

Don't NRF just now, one step at the time, for now Try the wifi chat server.

Cause I know the NRF part will work right away so dont worry about that just yet. Let's get starting by the unknown part.
As we fight our way northward into the great unknown, only that one thing remains certain...

Frederic_Plante

As we fight our way northward into the great unknown, only that one thing remains certain...

Trixi

No, that was my intention at all -to get connected to my WLAN only with the NFR24L01+  ;)
Dum spiro, spero - if you find my posting helpful, please click my Karma :)

Frederic_Plante

#21
Sep 10, 2013, 09:53 pm Last Edit: Sep 11, 2013, 12:56 am by Frédéric_Plante Reason: 1
If it's the case you will set the NRF device on pin 11, 12, 13 for the SPI. And you will have to:

Code: [Select]

Mirf.cePin = 9;
Mirf.csnPin = 8;


Since your WIFI shieild is using pin 10 as you can see here:

As we fight our way northward into the great unknown, only that one thing remains certain...

Frederic_Plante

#22
Sep 10, 2013, 10:00 pm Last Edit: Sep 10, 2013, 10:02 pm by Frédéric_Plante Reason: 1
So basicaly like the picture at the bottom:
As we fight our way northward into the great unknown, only that one thing remains certain...

Trixi

No, that was my intention at all -to get connected to my WLAN only with the NFR24L01+ and without the WiFi shield  ;)
Dum spiro, spero - if you find my posting helpful, please click my Karma :)

Frederic_Plante

Ok so how do you connect to your WIFI Lan if not with the WIFI shield? Do you connect using a RJ-45 cable?
As we fight our way northward into the great unknown, only that one thing remains certain...

Frederic_Plante

#25
Sep 10, 2013, 10:05 pm Last Edit: Sep 10, 2013, 10:07 pm by Frédéric_Plante Reason: 1
Oh you want to connect to your WIFI router with the NRF device? Forget about that. You would have to find the full WIFI connect procédure and even the i'm not sure the chanel match
As we fight our way northward into the great unknown, only that one thing remains certain...

Trixi

Dum spiro, spero - if you find my posting helpful, please click my Karma :)

Frederic_Plante

Yeah I see what you mean, but no. you can make a network, like WIFI, but not WIFI as such. it's more complicated then just a frequency match.

Even if you manage to fit the full procédure, I don't think there will be any mémory left to work with in you Arduino after that.
As we fight our way northward into the great unknown, only that one thing remains certain...

Trixi

#28
Sep 10, 2013, 10:13 pm Last Edit: Sep 10, 2013, 10:20 pm by Trixi Reason: 1
=(
i dont want to buy the expensive WiFi Shield, so i searched for alternatives and thought, this could work.

So thanks a lot for your help (your Karma got a "hit")  :)
Dum spiro, spero - if you find my posting helpful, please click my Karma :)

Frederic_Plante

#29
Sep 10, 2013, 10:40 pm Last Edit: Sep 10, 2013, 10:52 pm by Frédéric_Plante Reason: 1
Without the will to make a publicity for a particular product or place, have you consider product like those:

http://www.aliexpress.com/item/2-4G-Wireless-Module-TLG10UA03-Embedded-Uart-Wifi-Module-UART-WiFi-Network-Server-Client-IEEE802-11b/988481350.html

It's not to expensive, it's got ip stacking built in and all
As we fight our way northward into the great unknown, only that one thing remains certain...

Go Up