control arduino from website

<!DOCTYPE html> 
<html> 
<head>
<style>
.button {
background-color: #4CAF50;
border: 2px solid #4CAF50;;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
</style>
</head>
<body> 
<center><h1 style="color:blue;">ESP32 Web server LED controlling example</h1></center> 
<center><h2 style="color:black;">Web Server Example Microcontrollerslab.com</h2></center> 
<center><h2 style="color:Green;">Press "ON" button to turn on led and "OFF" button to turn off LED</h3></center> 
<form> 
<center>
<button class="button" name="LED0" value="ON" type="submit">LED0 ON</button> 
<button class="button" name="LED0" value="OFF" type="submit">LED0 OFF</button><br><br> 
<button class="button" name="LED1" value="ON" type="submit">LED1 ON</button> 
<button class="button" name="LED1" value="OFF" type="submit">LED1 OFF</button> <br><br>
<button class="button" name="LED2" value="ON" type="submit">LED2 ON</button> 
<button class="button" name="LED2" value="OFF" type="submit">LED2 OFF</button> 
</center>
</form> 
</body> 
</html>

4
3
Pete 100 points

                                    if (header.indexOf(&quot;LED0=ON&quot;) != -1) 
{
Serial.println(&quot;GPIO23 LED is ON&quot;);
LED_ONE_STATE = &quot;on&quot;;
digitalWrite(GPIO_PIN_NUMBER_22, HIGH);
} 
if (header.indexOf(&quot;LED0=OFF&quot;) != -1) 
{
Serial.println(&quot;GPIO23 LED is OFF&quot;);
LED_ONE_STATE = &quot;off&quot;;
digitalWrite(GPIO_PIN_NUMBER_22, LOW);
} 
if (header.indexOf(&quot;LED1=ON&quot;) != -1)
{
Serial.println(&quot;GPIO23 LED is ON&quot;);
LED_TWO_STATE = &quot;on&quot;;
digitalWrite(GPIO_PIN_NUMBER_23, HIGH);
}
if (header.indexOf(&quot;LED1=OFF&quot;) != -1) 
{
Serial.println(&quot;GPIO23 LED is OFF&quot;);
LED_TWO_STATE = &quot;off&quot;;
digitalWrite(GPIO_PIN_NUMBER_23, LOW);
}
if (header.indexOf(&quot;LED2=ON&quot;) != -1) 
{
Serial.println(&quot;GPIO15 LED is ON&quot;);
LED_THREE_STATE = &quot;on&quot;;
digitalWrite(GPIO_PIN_NUMBER_15, HIGH);
}
if(header.indexOf(&quot;LED2=OFF&quot;) != -1) {
Serial.println(&quot;GPIO15 LED is OFF&quot;);
LED_THREE_STATE = &quot;off&quot;;
digitalWrite(GPIO_PIN_NUMBER_15, LOW);
}

4 (3 Votes)
0
Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source