Error all wifi examples


#1

We tried all examples with wifi for ESP8266. Including created an access point.
We looked at similar error topics on the forum, and did as the advice was there.
We flashed Lisp three times in the Arduino IDE for our three new boards.
We tried different combinations of running examples and their frequency…
However, the result is always missing.

The mobile phone or laptop sees the hotspot and easily connects to it.
However, it is not possible to get a page from a browser or, in another example, connect a terminal program via WiFi.
We invariably get "192.168.4.1 - This site cannot be accessed!
Here is one of the code options:

(defun println (x s) (princ x s) 
    (princ #\return s) (princ #\newline s))
    
(defun webpage ()
  (loop
   (with-client (s)
     (loop
      (let ((line (read-line s)))
        (when (null line) (return))
        (print line)))
    (println "HTTP/1.1 200 OK" s)
    (println "Content-Type: text/html" s)
    (println "Connection: close" s)
    (println "" s)
    (princ "< !DOCTYPE HTML ><html><body><h1>ADC Value: " s)
    (princ (analogread 0) s)
    (println "</h1></body></html>" s)
    (println "" s))
   (delay 5000)))
  
 ;; Start
 ;; (wifi-softap "Bonzo")
 ;; (webpage)

#2

I’ve just checked the example with uLisp 4.0b on my Adafruit ESP8266 Feather and I can get it to work OK. Here’s the full sequence:

Connect the ESP8266 to your local Wi-Fi network with your network name and password; for example:

> (wifi-connect "Network" "secret")
"10.0.1.54"

Define the two functions:

(defun println (x s) (princ x s) 
    (princ #\return s) (princ #\newline s))

(defun webpage ()
  (loop
   (with-client (s)
     (loop
      (let ((line (read-line s)))
        (when (null line) (return))
        (print line)))
    (println "HTTP/1.1 200 OK" s)
    (println "Content-Type: text/html" s)
    (println "Connection: close" s)
    (println "" s)
    (princ "<!DOCTYPE HTML><html><body><h1>ADC Value: " s)
    (princ (analogread 17) s)
    (println "</h1></body></html>" s)
    (println "" s))
   (delay 5000)))

Note that on the ESP8266 you need to use pin 17 for the analogue input.

Run the wi-fi server on the ESP8266 with:

> (wifi-server)
nil

Now run the function to generate the webpage:

(webpage)

You should now be able to connect from a web browser on the network by typing the address:

10.0.1.54

or whatever the wifi-connect command printed out.

The command (wifi-softap "Bonzo") is not relevant to this example; you’re not creating a soft access point here.

Let me know if it works!


#3

In the examples of Wifi “Access Point” you wrote that you can create an access point, and then everything should work as in the server.
We do not have a local wifi, and we create it for remote connection to the device.
Why does not it work?


#4

OK, I understand now. I’ll investigate.


#6

OK, I’ve got it working. Your example should work, but you’ve got to do:

(wifi-softap "Bonzo")

Then connect your computer to the network Bonzo. Then do:

(wifi-server)
(webpage)

Then connect your web browser to the address that wifi-softap printed, such as 192.168.4.1, and you should see the webpage.

In other words, you missed out the (wifi-server) step.


#7

Already tried that too. Here we tried again (see below). Nothing works. More precisely, the phone or laptop connects to the Bonzo network, and the browser has a blank screen, and PTM “timeout exceeded”.

> (defun println(x s) (princ x s)(princ #\return s) (princ #\newline s))
println

3972> (defun webpage ()(loop(with-client (s)(loop(let ((line (read-line s)))
(when (null line) (return))(print line)))(println "HTTP/1.1 200 OK" s)
(println "Content-Type: text/html" s)(println "Connection: close"s)(println "" s)
(princ "<!DOCTYPE HTML><html><body><h1>ADC Value: " s)
(princ (analogread 0) s)(println "</h1></body></html>" s)(println "" s))(delay 5000)))
webpage

3851> (wifi-softap "Bonzo")
"192.168.4.1"

3851> (wifi-server)
nil

3851> (webpage)

#8

I’m not sure what to suggest. I’ve just tried again and it worked for me.

Perhaps someone else could try this.

Might there be a problem with a network with no password on your setup? Perhaps try creating the soft access point with a password with:

(wifi-softap "Bonzo" "secret")

#9

Note that you need to change:

(analogread 0)

to:

(analogread 17)