-
Notifications
You must be signed in to change notification settings - Fork 856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
basic example code for Issue/324 on reading VSYS/VBUS while using wifi on Pico_W #326
Conversation
…xt can be impreved to be more in line with other examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to rebase onto latest pico-examples develop (you seem to have picked up ws2812 changes somehow), and use latest pico-sdk develop (because you will want to include pico/cyw43_arch.h
instead of anything more specific)
Also please look at the latest updates to pico_w examples in terms of how polling is done in examples
printf("[1] http status %d \n", err); | ||
} | ||
else{ | ||
printf("[1] http client is busy...\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are all these [1]
supposed to indicate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, some leftover from debugging, totally irrelevant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover, as in, I was running the http request on core1 initially, so it was indicating from which core the printf was coming...
#include "pico/stdlib.h" | ||
#include "pico/cyw43_arch.h" | ||
#include "hardware/gpio.h" | ||
#include "hardware/adc.h" //to read ADC for soil moisture sensor, connected to pin 36 (3.3V), pin 33 (GND/AGND), pin 34 (GPIO28/ADC2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
soil moisture sensor - huh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one of these: https://arduino-tutorials.net/tutorial/capacitive-soil-moisture-sensor-arduino
I left the sensor reading in there to make the example at least a little more interesting.
Glad it worked. I can make the changes needed to get it into pico-examples if you like. |
I will be quite busy the following days, so if you have time to clean it up, be my guest. I mainly already wanted to share my solution so that other people can benefit from it. |
is this superseded by #331 ? |
Yes. The contribution from @pspeybro was helpful in adding this to the examples. |
This is a basic example on how to read VSYS and VBUS using ADC3 and WL_GPIO2 which share pins with wifi, so extra measures need to be taken to make sure wifi keeps working.
See also discussion on raspberrypi/pico-sdk#1222
There are probably some minor updates needed to align it with the other examples (for example put the wifi SSID and password and host ip address in Cmake file), but putting it up here so other people can find it as well.
It seems like I pulled in a few other commits, possibly because I created the branch from the master.