Well, my problem lies with the fact that i cannot seem to use any of the WiFly libs. They either spit out a lot of errors when compliling in arduino 1.0, or the sketch compiles, but hangs while executing.
However i found your post, and i could try to modify it:
//displays on lcd what comes out of the serial buffer
void readFromWifly(){
delay(100);
while(Serial.available() > 0) {
lcd.print(Serial.read(), BYTE);
}
delay(100);
}
I will try this once i get the chance.
Did you have any luck connecting the unit to your network? (as in you can ping and telnet in to the unit)
Perhaps you have some firewall on your pc blocking ping requests / telnet?
Also, i notice in your config that you have:
HOST=192.168.1.2:19999
Doesn't the WiFly try to auto connect to this address?
can you set this to:
HOST=0.0.0.0:2000
see if that does it?
Hi dhunt
I will try updating da wifly when i get home. When I ping it from da PC i get this message "Destination host unreachable" but when i ping the gate away i get responses back plus some stats on no. of packets sent and round trip time are shown on the cmd...
I tried pinging both the PC (192.168.1.2) and the gate away (192.168.1.1) from the wifly terminal but am not getting any response. I didnt get the part u said i need to change the uart mode to autoconnect as there is no such option but i guessed (judging from the reference guide) u meant setting bit 2 high (DATA TRIGGER makes connection on RX data) and so i did it that but no change...
I have a server program i created using java running on ma PC (192.168.1.2) that will be responsible in sending short messages via the wifly to an arduino with an LCD connected to it...am not familiar with wireshark but it wouldnt be a problem using it to monitor the packets...thanks..
mc, your problem sounds like network related problem. (once i got an IP on my WiFly it responded straight away to ping & telnet, so i guess so should yours..)
"Destination host unreachable" normally occurs when you have a problem routing your network traffic, but this is unlikely since you can ping your gateway in the same subnet.
can you give us the readout from some command line tools just to be sure:
ipconfig /all (gets all the network settings from your pc)
tracert
tracert
route print (show your IP v 4 route table)
this should tell us what path your pc is trying to take to the WiFly module, either there is something wrong here, there could be some software blocking ping / telnet requests (be it on your pc or router) or there are options in the WiFly module i'm not aware of .
Also, could you please confirm that your laptop is also connected through a wireless?
like i said, the problem is a network related one, i'm sure once you get that problem out of the way, you can telnet and ping from and to the WiFly straight away. Does (and what pattern) the WiFly blink?
The green LED(P104) blinks slowly meaning that its IP address is ok...if i may ask what is the response u get after pinging from the wifly terminal your gate away or host PC because for me am not getting any response (what does this mean?).....
To cancel the effect of unknown commands that may affect the performance of the device i applied factory reset command. I then sent the necessary commands to connect to my network. After successful connection I used the following commands
<2.23> set wlan ssid habs
AOK
<2.23> set wlan join 1
AOK
<2.23> save
Storing in config
<2.23> reboot
*Reboot*WiFly Ver 2.23, 04-26-2011 on 131C11
MAC Addr=00:06:66:14:a7:c7
Auto-Assoc Alhabsy chan=1 mode=WEP SCAN OK
Joining Alhabsy now..
*READY*
Associated!
DHCP: Start
DHCP in 50ms, lease=86400s
IF=UP
DHCP=ON
IP=192.168.1.9:2000
NM=255.255.255.0
GW=192.168.1.1
Listen on 2000
I also tried to do firmware update over ftp but i am getting the following response....
<2.23> set ftp user roving
AOK
<2.23> set ftp pass Pass123
AOK
<2.23> set ftp filename wifly-GSX.img
AOK
<2.23> ftp upload
<2.23> FTP connecting to 208.109.78.34
FTP timeout=2
<2.23> ftp update
<2.23> FTP connecting to 208.109.78.34
FTP timeout=2
Since you do got a DHCP address, but then can't ping the gateway that the DHCP server gave the WiFly, I'd agree with sponder and guess that there's a network problem.
What kind of router do you have? Have you been able to use any other wireless devices with it ( laptop, smartphone, etc)?
Well, your laptop seems to be ok. (routing is correct etc.) Can you confirm this by pinging a smartphone or other laptop, which is on the same WLAN (and also got an IP address from the same DHCP server)? If this works without any problems, the problem must be the WiFly.
This is probably the case since the test the other way around also fails (letting the WiFly ping the gateway.)
I would first confirm it's not your laptop (by pinging another device) and if that's successfull, i would try a different another WLAN / router / network.
If your findings are the same on another network, i would contact Roving Networks support. You might have a defective unit.
I am using dlink router for my home network and I have other laptops n smartphones on the same network....so I tried pinging one of the PC's n smartphone but am getting da same result of "destination host unreachable"...The same thing happened when I pinged from one of the other PC's . am going to try on another network
Sponder..what kind of response do u get when u ping your gateaway from da wifly?....this might help to compare with mine....
Its clear the problem hugely lies on my netw?ork since no device is appear to ping another...but wouldn't rule out defectiveness of the wifly since I her no response when I.ping da gate away?....can I get what kind of response to expect when you do so from the wifly serial terminal?.....
I don't have the unit at hand right now, but tried to test is like a week ago, i remember the response was a reply as you would expect.
Being unable to ping other devices on the network is a huge hint though! Try another router, see if you can ping across the network (from laptop to laptop to smartphone etc.) if that works you can bet your WiFly will start responding to ping / telnet / FTP as well.
edit: i did a quick google on DLINK routers and not being able to ping anything besides the router: read 4 stories, all four of them got solved by disabling the windows firewall. Can you check please turn off the firewall on both laptops and try pinging each other?
I am using Dlink router DSL-2640B....I guess its something to do with the router blocking the computers from pinging each other since turning off windows firewall hasn't solved the problem....
I remember reading several users using their WiFly in an adhoc connection with their laptops. Perhaps you could try that to confirm it's your router (before spending money on a new one)
Wishing i had more time to spend on this, i'm slowly getting somewhere.
Right now i have a sketch where the arduino puts the WiFly in command mode, sends the command to get the IP address, and puts the serial data received on a lcd.
The sketch works, but, the output (also via serial / telnet) contains:
<2.30>get ip a
get ip a
10.0.0.7
thus, the output doesn't only contain the IP address, but also the string we send, a few newline chars, and then the IP address.
The good news is that i can see the string, including a part of the IP address (the lcd isn't big enough to show the complete string of chars lol.)
Once i find the time to read up on parsing incoming serial data, (im sure there are plenty of examples online?..) i can try to parse the data to show only the IP address.
Would you be interested in testing / trying / reviewing / commenting on that code?
Hi guys...yah as u said the problem is my router not allowing devices to ping each other so i tried to change its configuration and it seems it doesn't support such protocol (icmp)...so i decided to use adhoc mode for the time being before i get hold of another advanced router..thanks guys for the help...let u know how i progress...
Sponder...did da function that u said u gonna use to read from the wifly work correctly i.e readFromWifly()...what do u want to display on the lcd...the commands and the response or the response alone?...if the characters are too long for the lcd you can make them to scroll left to right..(i believe there is such a function in the lcd library) or write a function to scroll up (worked 4 me)....
Well, like i said, i have trouble using any WiFly library. But as DHunt pointed out to me, you can also simply write all the commands to the WiFly module through the serial link.
I would like to display just the IP address on the lcd, but like i said in my previous post, the output of the get ip command is "get ip \n \n \n" instead of just the ip.
but hey, at least i can see some output, so it's just a matter of parsing the output before displaying it to the lcd. (right now everything in the serial buffer is shown on the lcd)
I hope to find some hours here and there upcomming weekend, so i can read up on parsing serial data on the arduino. (But since it's carnaval over here i dont think i can find those hours..)
I want the parsing out of the way before i'm even going to try to connect to a server, since once connected to a server i would like to let the server send a command, which in turn gets parsed (and executed) on the arduino.
did you allready connect your unit with a adhoc connection? Where you able to ping /telenet / FTP with it?
Yah with the adhoc mode i was able to ping and telnet successfully....but will be getting another router soon because am looking to send commands to arduino from quite a long range....
Yah me too am planning to do the same but first i tried to see if the app can be able to send the commands to the arduino but am getting unknownHostException.(Thrown to indicate that the IP address of a host could not be determined.) which is weird since i was able to ping and telnet the host(wifly)..Are you familiar with java?...maybe you can help. I am also looking for opinions in other forums and am also rechecking my code.
As soon as you solve one problem you run into another..thats the order of the day when dealing electronics...
I was able to ping and telnet successfully but the app couldnt communicate with the wifly shield...i am just running the terminal sketch that allows commands to be sent through the terminal...To implement server/client communication aren't we supposed to upload some kind of server/client sketch to the wifly?....I think my problem could be the wifly not accepting the connection in the first place from the app....hence the app throws unknownHost Exception....am i right?..
On the app i have this line of code and it seems it cannot get past the first of these two lines below...The output of the second line is never shown as the connection to the host i.e wifly shield is never made... I declared the host name as "WiFly-GSX" ( default device id of wifly) and port as 2000. I changed the port number but still same result.
Socket clientSocket = new Socket(host, port);
System.out.println("Connected to " + host + " in port " + port);
Heey guys...i was able to send messages to arduino but now I ran into another problem....I am using the adhoc connection between wifly and my PC but after successful connection the wifly just goes off completely(no LED blinkng)...strange isnt it?......I tried to reset to default factory setting to cancel any unnnecessary commands that i may have passed to the wifly accidentally but the problem still persists...but after leaving it without power for a while it goess on again...what could be the problem?...