I have an esp8266 and I cannot get the value to read HIGH when 3.3v is applied to directly to pin by hand. I have an Arduino Uno powering the esp8266. It connects to the WiFi like it should, and now all I want is to manually see that when I apply 3v that the state will change from 0 to 1. Does anyone know how I can do this.
When I apply 3 volts directly to pin 15 it outputs 0. Even if I try digitalWrite on the pin and set it to HIGH it still says 0 and i serialPrint. My end goal if to use the arduino uno to fire and ouput on pin 8. On the arduino UNO side I am using a super sonic sensor. When the sensor is triggered I want to turn pin 8 on. From there I want to take pin 8 to feed pin 15 on the 8266 as an input. Before I did that I just wanted to see that when you manually apply 3v that the pin would read 1 or HIGH but no matter I do it wont change value. Once I get that value as HIGH I can send a second request to the server like im already but now I want to say that there was an intruder. Im not sure why the value wont change but being a beginner with arduino Im trying to keep it simple and ideally would like to wire it in this manner.
#include <SoftwareSerial.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
const char* ssid = "********";
const char* password = "********";
HTTPClient http;
static const uint8_t D8 = 15;
int featherPin = D8;
//int trigPin = 13;
//int echoPin = 12;
//int ledPin = 10;
//int hornPin = 11;
//
//int spaceIntruded;
//
//long duration, cm, inches;
void setup() {
Serial.begin(115200);
pinMode(featherPin,INPUT);
WiFi.begin(ssid, password);
while(WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.println("Waiting for connection");
}
// Serial.begin (9600);
// pinMode(trigPin, OUTPUT);
// pinMode(echoPin, INPUT);
// pinMode(ledPin, OUTPUT);
// pinMode(hornPin, OUTPUT);
// delay(5000);
// Serial.println("Armed...");
}
void loop() {
if (WiFi.status() == WL_CONNECTED) {
Serial.println("yay connect");
http.begin("http://10.150.40.121:3000/");
http.addHeader("Content-Type", "text/plain");
int httpCode = http.POST("Message from ESP8266");
String payload = http.getString();
Serial.println(payload);
http.end();
} else {
Serial.println("Error in Wifi connection");
}
// digitalWrite(featherPin, HIGH);
int sensorValue = digitalRead(featherPin);
Serial.print(sensorValue);
// if (digitalRead(featherPin) == HIGH) {
// http.begin("http://10.150.40.121:3000/home");
// http.addHeader("Content-Type", "text/plain");
//
// int httpCode = http.POST("Message from ESP8266");
// String payload = http.getString();
// Serial.println(payload);
// Serial.print("hi");
// http.end();
// } else {
// Serial.print(featherPin);
// Serial.println("I am not hot");
// }
// digitalWrite(trigPin, LOW);
// delayMicroseconds(1);
// digitalWrite(trigPin, HIGH);
// delayMicroseconds(2);
// digitalWrite(trigPin, LOW);
//
// pinMode(echoPin, INPUT);
// duration = pulseIn(echoPin, HIGH);
//
// inches = (duration / 2) / 74;
// Serial.println(inches);
//
// spaceIntruded = inches;
//
// if (spaceIntruded <= 50 || spaceIntruded >= 900){
// digitalWrite(ledPin, HIGH);
// digitalWrite(hornPin, HIGH);
// Serial.println("Intruder Detected!");
// Serial.println("Sending text Notification...");
// delay(500);
// Serial.println("Armed...");
// }
//
// else{
// digitalWrite(hornPin, LOW);
// digitalWrite(ledPin, LOW);
// }
delay(30000);
}
{}
iconwhen I apply 3v that the state will change from 0 to 1
what are you applying 3v to? which pin? for how long? because you have a delay of 30 seconds in each loop - so you're only checking every 30 seconds