Hello,
I wrote a program which at one point look at IO35.
It is an ESP32
If IO35 is 1 (3 volts) the program flash a led forever.
If IO35 is 0 (0 volts) the program flash the led 40 seconds and stop.
I declared the IO35 in the H file as input
"#define VUSB 35 //Power when conected to USB"
In the setup section it is declared also as input
I am sorry, but I do not understand.
this declaration
`Preformatted text``
#define VUSB 35Preformatted text is on the H file with others. and this line ``if (VUSB == 0)
type or paste code here
it is on the loop section.
Bottom line, what is the correct form to read the status of the line?
It is high or it is low.
Can you post a sample code ?
Thank you
I do not know how to use the code posting here
Can you help?
I declared VUSB as pin for IO35, not value 35.
My program has different files.
One of them has the same name as the program name, but the termination is.h, like a header file.
Inside I have all the name and the corresponding IO number like here
... #ifndef _RF_SOLUTIONS_K #define _RF_SOLUTIONS_K
//INPUTS #define RFID_TX 25 //HUZZAH: pin A1 #define KV1 32 //new on HUZZAH, was 35 on ESP32 #define KV2 33 #define KV3 34 //HUZZAH: pin A2
#define VUSB 35 //Power when connected to USB
#define WDT_TIMEOUT 3
...
On the program, on the setup section I declared the IO35 as Input
pinMode(VUSB, INPUT);
Then in the loop, I look at it all the time.
From USB port, I have a divider of 3 volts connected at the port.
If I have USB connected, the voltage at the port is 3 volts, and with no USB, the voltage is 0 volts.
This is the whole configuration.