Hi,
I have set up on my Adruino ESP32 a AccessPoint. It works and will receive informations over the browser on my android. For example:
192.168.4.1/red=on
Will turn on the red LED on my ardunio. Now I want to send ColorInfomations over this connection. Therfore I have a Color-Picker on my Android and a Servo which can be controlled over the app.
I want to send from android to my ESP32 AP. The servo is to the arduino connected. Ther were no libraries.
Yes, the code is from the Make-Magazin and the arduino part should use a wifi router. I changed the code for the arduino part to be a access point. This works.
but in the serial monitor of the arduino ide nothing would be received. If i post the link in the browser on android, I receive it in the serial monitor. So I thought the app wont send anything.
from?
-b- did you try my idea with the make String send
and print it first ( so you see the send is attempted and the string is good.
-c- i not see where any of that 4 variables are defined,
can you test first with a fix string “send”
make sure “ip” is a string and not a tuple
-d- just to be sure the loadStrings works better use the correct syntax:
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at processing.core.PApplet.createInputRaw(PApplet.java:7058)
at processing.core.PApplet.createInput(PApplet.java:7011)
at processing.core.PApplet.loadStrings(PApplet.java:7465)
at farbzeiger.sendValues(farbzeiger.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at processing.core.PApplet.method(PApplet.java:3742)
at processing.core.PApplet$2.run(PApplet.java:3780)
The file “http://192.168.4.1/red/223.0/green/0.0/blue/54.0/servo/0.0” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
does it never work? possibly you send too often?
because you say when you send one time manually
via browser it works?
anyhow but now we know the real thing, what that, what you send, looks like,
and i hate that you send float, does not make sense at all.
but still the question is what the webserver does with it,
so now you check again using the browser,
but give this exact string: http://192.168.4.1/red/223.0/green/0.0/blue/54.0/servo/0.0
is there any response from the server like “OK” that the URL is understood?
does it not work but work with sending http://192.168.4.1/red/223/green/0/blue/54/servo/0
and you must find out how often you send that,
i not see a restriction on that, so there could be flooding
as soon you touch mouse…
because you do the
action go ( via color picker.update )
and never check if the variables ( red green blue ) have changed by 1.x
also the servo looks restricted by 5, it is not, the value is restricted, the sending NOT.
can you link ( or provide ) the full code ( even the ESP32 )
I changed the android app to send only “Hello” anytime. In Procession with JAVA connected from my Mac to the Arduino AccessPoint it works. I got no error in the Processing konsole and the text will be received in the Serial Monitor on my ESP32.
Now I ported the App with Processing to my Android Phone and there it never works. Sending the same Text in Android browser get the result in the Serial Monitor.
You have arduino unit that is connected to Processing via serial
You have some code that you can load in a browser. The browser sends the message which is received by a Processing sketch. This sketch delivers the message to the arduino via serial monitor, correct?
You have also an android app made using Processing. When you send the request using your app, it does not work. This is the issue if I am following the discussion.
Can you tell me what permissions you enabled in your Android app?
Did you try running this app from the PDE while the device was still connected to your computer? Do you get any errors in the PDE console?