Shop OBEX P1 Docs P2 Docs Learn Events
Wifi Question — Parallax Forums

Wifi Question

hooktxuhooktxu Posts: 33
edited 2009-07-07 08:52 in Propeller 1
Hi, I have a wifi secure socket and I have to put a WPA password to connect to ir correctly. I use this code but it give me an error.

    serialIWi.str(string("AT+iWLSI=red))

    serialIWi.tx($0D)
    

    i:= 0
    repeat 
      iWLSIResponse[i]:=serialIWi.rx
      i++
    while NOT(iWLSIResponse[noparse][[/noparse]i-1]==$0A)
      
    
    serialPC.str(@iWLSIResponse[noparse][[/noparse]0])
  
    serialPC.str(string("MoreLab2 OK"))                  

    ''------------------- 
    serialIWi.str(string("AT+iWSTO=3"))
    serialIWi.tx($0D)

    i:= 0
    repeat 
      iWST0Response[i]:=serialIWi.rx
      i++
    while NOT(iWST0Response[noparse][[/noparse]i-1]==$0A)
      
    
    serialPC.str(@iWST0Response[noparse][[/noparse]0])

    serialPC.str(string("WEP OK"))

    ''-------------------
    
    serialIWi.str(string("AT+iWLPP=modjjjdu"))
    serialIWi.tx($0D)

    i:= 0
    repeat 
      iWLPPResponse[i]:=serialIWi.rx
      i++
    while NOT(iWLPPResponse[noparse][[/noparse]i-1]==$0A)
      
    
    serialPC.str(@iWLPPResponse[noparse][[/noparse]0])

    serialPC.str(string("Clave OK"))

[/i][/i][/i]

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2009-07-07 08:52
    Would you please be so kind and provide all the information that you have in more detail! What kind of error? Is it a compile error or is your program not running as expected?
    I assume it's both:
    1.
    serialIWi.str(string("AT+iWLSI=red))
    serialIWi.str(string("AT+iWLSI=red[b][color=red]"[/color][/b]))
    

    2.
    iWLSIResponse[i]:=serialIWi.rx[/i]
    iWLSIResponse[b][color=red][noparse][[/noparse]i][/color][/b][i]:=serialIWi.rx[/i]
    

    Same problem for the other responses!

    3.
    [i]    while NOT(iWLSIResponse[noparse][[/noparse]i-1]==$0A)
          
        
        serialPC.str(@iWLSIResponse[noparse][[/noparse]0])[/i]
    
    

    You don't add the string terminator after reading the response. Is the response fixed in size? I'd replace the $0a with a $0 or add a $0 after the response.
    Plus .. you don't check for the size of the response. That could produce buffer overflows, for example if you don't set the baudrade adequate on both sides ... or if you have noise on the communication lines ....

    Post Edited (MagIO2) : 7/7/2009 8:58:15 AM GMT
Sign In or Register to comment.