Low voltage on all pins, even 5v and 3.3v [RESOLVED]
Posted: Sun Apr 14, 2019 3:54 pm
Hi,
I was trying to power a simple led, but when I set the output high it flickered. So i measured the voltage whit an external multimeter and it said 0.3v! So I tested the voltage on 5v and it was 1.8, on 3.3v was 0.3.
Despite this the board was in softAP mode and communicating with the computer.
P.S. Sorry for my bad english
Edit:
The bad measurement were caused by an error on the serygraphy of the board. The pin that I was thinking was ground is instead the CMD pin.
Here is the code, but I don't this is important
#include <WiFi.h>
#include "FS.h"
#include "SPIFFS.h"
#define CORE 1
#define LED_BUILTIN 26
const char *ssid = "esp32";
WiFiServer server(80);
File icon;
void setup() {
pinMode(LED_BUILTIN,INPUT_PULLUP);
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println();
if(!SPIFFS.begin(true)){
Serial.println("SPIFFS failed");
}
WiFi.softAP(ssid);
IPAddress myIP = WiFi.softAPIP();
Serial.println("ESP32 IP:");
Serial.println(myIP);
server.begin();
Serial.println("Server started");
xTaskCreatePinnedToCore(
TaskRespondeToClient
, "Responde Task"
, 4096
, NULL
, 2
, NULL
, CORE);
}
void loop() {
// put your main code here, to run repeatedly:
delay(1);
}
void TaskRespondeToClient(void *par) {
while (true) {
WiFiClient client = server.available(); // listen for incoming clients
if (client) { // if you get a client,
Serial.println("New Client."); // print a message out the serial port
String currentLine = "";
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (c != '\n' && c != '\r') {
currentLine += c;
}
if (c == '\n') {
if (currentLine.length() == 0) {
sendResponse(client);
break;
}
Serial.println("----fromClient: " + currentLine);
currentLine = "";
}
}
readLine(currentLine, client);
}
client.stop();
Serial.println("Client Disconnected.");
}
}
}
void sendResponse(WiFiClient client) {
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();
// the content of the HTTP response follows the header:
client.print("<font size=\"32\">");
client.print("Click <a href=\"/H\">here</a> to turn ON the LED.<br>");
client.print("Click <a href=\"/L\">here</a> to turn OFF the LED.<br>");
client.print("</font>");
// The HTTP response ends with another blank line:
client.println();
}
void readLine(String inputLine, WiFiClient client) {
// Check to see if the client request was "GET /H" or "GET /L":
if (inputLine.endsWith("GET /H")) {
Serial.println("Led on");
digitalWrite(LED_BUILTIN, HIGH); // GET /H turns the LED on
}
if (inputLine.endsWith("GET /L")) {
Serial.println("Led off");
digitalWrite(LED_BUILTIN, LOW); // GET /L turns the LED off
}
if (inputLine.endsWith("GET /favicon.ico")) {
Serial.println("Sending icon");
client.println(F("HTTP/1.1 200 OK\n"
"Content-Type: image/x-icon\n"
"Connection: keep-alive\n"));
icon=SPIFFS.open("/favicon.ico");
if(icon.isDirectory()){
Serial.println("icon opened");
}
while(icon.available()){
client.write(icon.read());
}
icon.close();
client.println();
}
}
I was trying to power a simple led, but when I set the output high it flickered. So i measured the voltage whit an external multimeter and it said 0.3v! So I tested the voltage on 5v and it was 1.8, on 3.3v was 0.3.
Despite this the board was in softAP mode and communicating with the computer.
P.S. Sorry for my bad english
Edit:
The bad measurement were caused by an error on the serygraphy of the board. The pin that I was thinking was ground is instead the CMD pin.
Here is the code, but I don't this is important
#include <WiFi.h>
#include "FS.h"
#include "SPIFFS.h"
#define CORE 1
#define LED_BUILTIN 26
const char *ssid = "esp32";
WiFiServer server(80);
File icon;
void setup() {
pinMode(LED_BUILTIN,INPUT_PULLUP);
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println();
if(!SPIFFS.begin(true)){
Serial.println("SPIFFS failed");
}
WiFi.softAP(ssid);
IPAddress myIP = WiFi.softAPIP();
Serial.println("ESP32 IP:");
Serial.println(myIP);
server.begin();
Serial.println("Server started");
xTaskCreatePinnedToCore(
TaskRespondeToClient
, "Responde Task"
, 4096
, NULL
, 2
, NULL
, CORE);
}
void loop() {
// put your main code here, to run repeatedly:
delay(1);
}
void TaskRespondeToClient(void *par) {
while (true) {
WiFiClient client = server.available(); // listen for incoming clients
if (client) { // if you get a client,
Serial.println("New Client."); // print a message out the serial port
String currentLine = "";
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (c != '\n' && c != '\r') {
currentLine += c;
}
if (c == '\n') {
if (currentLine.length() == 0) {
sendResponse(client);
break;
}
Serial.println("----fromClient: " + currentLine);
currentLine = "";
}
}
readLine(currentLine, client);
}
client.stop();
Serial.println("Client Disconnected.");
}
}
}
void sendResponse(WiFiClient client) {
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();
// the content of the HTTP response follows the header:
client.print("<font size=\"32\">");
client.print("Click <a href=\"/H\">here</a> to turn ON the LED.<br>");
client.print("Click <a href=\"/L\">here</a> to turn OFF the LED.<br>");
client.print("</font>");
// The HTTP response ends with another blank line:
client.println();
}
void readLine(String inputLine, WiFiClient client) {
// Check to see if the client request was "GET /H" or "GET /L":
if (inputLine.endsWith("GET /H")) {
Serial.println("Led on");
digitalWrite(LED_BUILTIN, HIGH); // GET /H turns the LED on
}
if (inputLine.endsWith("GET /L")) {
Serial.println("Led off");
digitalWrite(LED_BUILTIN, LOW); // GET /L turns the LED off
}
if (inputLine.endsWith("GET /favicon.ico")) {
Serial.println("Sending icon");
client.println(F("HTTP/1.1 200 OK\n"
"Content-Type: image/x-icon\n"
"Connection: keep-alive\n"));
icon=SPIFFS.open("/favicon.ico");
if(icon.isDirectory()){
Serial.println("icon opened");
}
while(icon.available()){
client.write(icon.read());
}
icon.close();
client.println();
}
}