noturnalz
Posts: 5
Joined: Wed May 10, 2023 6:10 pm

GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point

Wed May 24, 2023 5:56 pm

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.

User avatar
neilgl
Posts: 6091
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point

Wed May 24, 2023 8:06 pm

How are you starting the Flask server - on a particular ip address and port?

noturnalz
Posts: 5
Joined: Wed May 10, 2023 6:10 pm

Re: GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point

Wed May 24, 2023 9:51 pm

Hi,
I'm starting the flask server via

Code: Select all

sudo python app.py
I thought this was the entry point(?).
Regards,
Ron.

noturnalz
Posts: 5
Joined: Wed May 10, 2023 6:10 pm

Re: GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point

Wed May 24, 2023 10:20 pm

within app.py, I'm starting with:

Code: Select all

if __name__=='__main__':
    app.run(host='0.0.0.0', debug=True, threaded=True)
@ 192.168.4.1:5000

I'm using the same address as the article for the moment.

User avatar
neilgl
Posts: 6091
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point

Thu May 25, 2023 7:01 pm

If I use

Code: Select all

   app.run(host='0.0.0.0', port=8080, debug=True)
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:

Code: Select all

192.168.4.2 - - [25/May/2023 19:52:53] "GET / HTTP/1.1" 200 -
So I must be doing something different to you?

Also works OK if I use

Code: Select all

   app.run(host='0.0.0.0', debug=True)
and the default port 5000.
And OK using

Code: Select all

   app.run(host='0.0.0.0', debug=True, threaded=True)
My test script uses: import RPi.GPIO as GPIO

noturnalz
Posts: 5
Joined: Wed May 10, 2023 6:10 pm

Re: GPIO25 (and GPIO is general) as well as UART stops working after connecting as access point

Fri May 26, 2023 2:58 am

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:

Code: Select all

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js">
        // add something if needed...
    </script>
So I downloaded jquery and made it static : /static/js and referenced it in my html file. And everything lit up.

Return to “Other projects”