Hi,
Has anyone experienced a similar behavior:
I've set up my Pi Zero 2 W as an access point (Flask + Javascript + HTML) and there's an LED connected between GND and GPIO25. I'm using the gpiozero lib. If I'm not in access point mode and connected over my Wifi-router-SSH, the GPIO25 pin will turn on the LED when I push the 'ON' button. However, as soon as I configure over to access point mode via https://www.raspberrypi.com/documentati ... cess-point, I'm not able to turn the GPIO on. My serial Sparkfun 7-segment serial display over GPIO14/15 (TX/RX) also stops working. Looking at the debug output in VS Code while the FLask server is running, I don't see any page status/comment returns when I push the button(s). If I turn off access point mode, there's no issues and I'm able to turn on/off GPIO25 as well as control the 7-seg display over UART.
Thank you.
RW.
Re: GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point
How are you starting the Flask server - on a particular ip address and port?
Re: GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point
Hi,
I'm starting the flask server via
I thought this was the entry point(?).
Regards,
Ron.
I'm starting the flask server via
Code: Select all
sudo python app.py
Regards,
Ron.
Re: GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point
within app.py, I'm starting with:
@ 192.168.4.1:5000
I'm using the same address as the article for the moment.
Code: Select all
if __name__=='__main__':
app.run(host='0.0.0.0', debug=True, threaded=True)
I'm using the same address as the article for the moment.
Re: GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point
If I use in the flask python app, I can connect to it OK when the pi (my pi3) is configured as an Access Point (no routing) as per the official documentation.
i.e. from a Galaxy S20 connected via WiFI to NameOfNetwork, I start Firefox and go to the pi ip address http://192.168.4.1:8080
The flask logging on the pi shows a GET request as expected:
So I must be doing something different to you?
Also works OK if I use and the default port 5000.
And OK using
My test script uses: import RPi.GPIO as GPIO
Code: Select all
app.run(host='0.0.0.0', port=8080, debug=True)
i.e. from a Galaxy S20 connected via WiFI to NameOfNetwork, I start Firefox and go to the pi ip address http://192.168.4.1:8080
The flask logging on the pi shows a GET request as expected:
Code: Select all
192.168.4.2 - - [25/May/2023 19:52:53] "GET / HTTP/1.1" 200 -
Also works OK if I use
Code: Select all
app.run(host='0.0.0.0', debug=True)
And OK using
Code: Select all
app.run(host='0.0.0.0', debug=True, threaded=True)
Re: GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point
Hi,
Thank you so much for the reply. The issue stemmed from myself using the jquery src from google in index.html. The access point was working and I checked it again with your suggestions. So being that I was able to connect to it and seeing how some button components worked and some didn't (ie the UART/GPIO), I started going through line by line in the index.html and app.py. That's when I noticed:
So I downloaded jquery and made it static : /static/js and referenced it in my html file. And everything lit up.
Thank you so much for the reply. The issue stemmed from myself using the jquery src from google in index.html. The access point was working and I checked it again with your suggestions. So being that I was able to connect to it and seeing how some button components worked and some didn't (ie the UART/GPIO), I started going through line by line in the index.html and app.py. That's when I noticed:
Code: Select all
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">
// add something if needed...
</script>