This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

ESP32 Dev kit --Reg
#1
#include <phyphoxBle.h>

int analogPin = A3;
int Rawval ; // variable to store the value read
float Scaleval ;
int RELAY_pin = 10; // Relay is connected to pin D10
void setup()
{
Serial.begin(9600); // setup serial
pinMode(RELAY_pin, OUTPUT);
PhyphoxBLE:Confusedtart();
}

void loop()
{
int Rawval = analogRead(analogPin);
Serial.print("Rawvalue from Analog input =");
Serial.print(Rawval);
Scaleval = map(Rawval, 0, 675, 0, 20);
Serial.print(" Scaled Value =");
Serial.println(Scaleval);
PhyphoxBLE::write(Scaleval);    //Send value to phyphox
    delay(100); 

if ( Rawval < 169) digitalWrite(RELAY_pin, HIGH);
else digitalWrite(RELAY_pin, LOW);
}
What will be the analog pin?
Reply


Messages In This Thread
ESP32 Dev kit --Reg - by pikubose - 02-02-2023, 10:03 AM
RE: ESP32 Dev kit --Reg - by Jens Noriʇzsɔɥ - 02-03-2023, 11:09 AM

Forum Jump: