user77698: I am brand new to Arduino. So I apologize in advance if I have missed the information I am looking for. I have looked for hours and cannot find any help with a Adafruit Featherwing Latching Relay(#2923 on Adafruit). This is the one that has 2 set pins "Set" & "Unset". I would love to use a Wemos d1 mini to trigger this relay. But I cannot find any sketchs or documentation on how to get started.
Ideally the setup would have a push button to toggle between states as well as the basic esp8266 web page to toggle state as well.
I am just trying to turn off/on some LEDs. And want to run the switch via this setup.
Thanks
E
Well I am further along. I was able to get most of this working but now the CSS i am using is causing headaches. The code below errors on "page = <style......"
the html
//the HTML of the web page
page = "<style>  .button{    background-color:red;    color:blue;    border-radius: 8px;    padding: 12px 24px;  }</style><h1>Simple NodeMCU Web Server</h1><p>    <a href="LEDOn"><button class="button">ON</button></a>    &nbsp;    <a href="LEDOff"><button>OFF</button></a></p>";
I get the error 'inconsistent user-defined literal suffixes 'LEDOn' and 'button' in string literal'
Any help would most appreciated. This line is the only one failing in my sketch

user77698: I will add the final code here. It took me weeks to find a starting place and many hours of trial and error to sort it all out. With help I was able to get a stable working switch.
This code was written for a Wemos D1 Mini coupled to a Adafruit Featherwing Latching relay. Since it has Set and Unset pins coding this was struggle for me. The Set/Unset pins only require a pulse to trigger them then they stay 'Latched' in state. even if power is lost. I found the base code here and it took a bit of tweaking to get it to work.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

// Replace with your network credentials
const char* ssid = "SSID";
const char* password = "PASSWORD";

ESP8266WebServer server(80);   //instantiate server at port 80 (http port)

String page = "";
int LEDUnsetPin = D1;
int LEDSetPin = D2;
void setup(void){
 //the HTML of the web page
 //don’t forget you need estapes (") around the quotes
 page = "<style>  .button{    background-color:red;    color:blue;    border-radius: 8px;    padding: 12px 24px;  }</style><h1>Kitchen LEDs</h1><p>    <a href=\"LEDOn\"><button class=\"button\">ON</button></a>    &nbsp;    <a href=\"LEDOff\"><button>OFF</button></a></p>";
 //make the LED pins output and initially turned off
 pinMode(LEDUnsetPin, OUTPUT);
 digitalWrite(LEDUnsetPin, LOW);
 pinMode(LEDSetPin, OUTPUT);
 digitalWrite(LEDSetPin, LOW);

 delay(1000);
 Serial.begin(115200);
 WiFi.begin(ssid, password); //begin WiFi connection
 Serial.println("");

 // Wait for connection
 while (WiFi.status() != WL_CONNECTED) {
   delay(500);
   Serial.print(".");
 }
 Serial.println("");
 Serial.print("Connected to ");
 Serial.println(ssid);
 Serial.print("IP address: ");
 Serial.println(WiFi.localIP());

 server.on("/", [](){
   server.send(200, "text/html", page);
 });

 //turn on the on pin and turn off the off pin
 server.on("/LEDOn", [](){
   server.send(200, "text/html", page);
   digitalWrite(LEDSetPin, HIGH);
   delay(10);
   digitalWrite(LEDSetPin, LOW);
   delay(10);
 });

 //turn off the on pin and turn on the off pin
 server.on("/LEDOff", [](){
   server.send(200, "text/html", page);
   digitalWrite(LEDUnsetPin, HIGH);
   delay(10);
   digitalWrite(LEDUnsetPin, LOW);
   delay(10);
 });
 server.begin();
 Serial.println("Web server started!");
}

void loop(void){
 server.handleClient();
}


77698: <p>I am brand new to Arduino. So I apologize in advance if I have missed the information I am looking for. I have looked for hours and cannot find any help with a Adafruit Featherwing Latching Relay(#2923 on Adafruit). This is the one that has 2 set pins &quot;Set&quot; &amp; &quot;Unset&quot;. I would love to use a Wemos d1 mini to trigger this relay. But I cannot find any sketchs or documentation on how to get started.</p>
<p>Ideally the setup would have a push button to toggle between states as well as the basic esp8266 web page to toggle state as well.</p>
<p>I am just trying to turn off/on some LEDs. And want to run the switch via this setup.</p>
<p>Thanks
E</p>
<p>Well I am further along. I was able to get most of this working but now the CSS i am using is causing headaches. The code below errors on &quot;page = &lt;style......&quot;
the html</p>
<p>//the HTML of the web page</p>
<p><code>page = &quot;&lt;style&gt;  .button{    background-color:red;    color:blue;    border-radius: 8px;    padding: 12px 24px;  }&lt;/style&gt;&lt;h1&gt;Simple NodeMCU Web Server&lt;/h1&gt;&lt;p&gt;    &lt;a href=&quot;LEDOn&quot;&gt;&lt;button class=&quot;button&quot;&gt;ON&lt;/button&gt;&lt;/a&gt;    &amp;nbsp;    &lt;a href=&quot;LEDOff&quot;&gt;&lt;button&gt;OFF&lt;/button&gt;&lt;/a&gt;&lt;/p&gt;&quot;;</code></p>
<p>I get the error 'inconsistent user-defined literal suffixes 'LEDOn' and 'button' in string literal'</p>
<p>Any help would most appreciated. This line is the only one failing in my sketch</p>
 77698: <p>I will add the final code here. It took me weeks to find a starting place and many hours of trial and error to sort it all out. With help I was able to get a stable working switch.</p>
<p>This code was written for a Wemos D1 Mini coupled to a Adafruit Featherwing Latching relay. Since it has Set and Unset pins coding this was struggle for me. The Set/Unset pins only require a pulse to trigger them then they stay 'Latched' in state. even if power is lost. I found the <a href="https://michaelweinberg.org/post/170722380870/control-led-lights-with-a-webpage-esp8266-relay" rel="nofollow noreferrer">base code here</a> and it took a bit of tweaking to get it to work.</p>
<pre><code>#include &lt;ESP8266WiFi.h&gt;
#include &lt;WiFiClient.h&gt;
#include &lt;ESP8266WebServer.h&gt;

// Replace with your network credentials
const char* ssid = &quot;SSID&quot;;
const char* password = &quot;PASSWORD&quot;;

ESP8266WebServer server(80);   //instantiate server at port 80 (http port)

String page = &quot;&quot;;
int LEDUnsetPin = D1;
int LEDSetPin = D2;
void setup(void){
 //the HTML of the web page
 //don’t forget you need estapes (&quot;) around the quotes
 page = &quot;&lt;style&gt;  .button{    background-color:red;    color:blue;    border-radius: 8px;    padding: 12px 24px;  }&lt;/style&gt;&lt;h1&gt;Kitchen LEDs&lt;/h1&gt;&lt;p&gt;    &lt;a href=\&quot;LEDOn\&quot;&gt;&lt;button class=\&quot;button\&quot;&gt;ON&lt;/button&gt;&lt;/a&gt;    &amp;nbsp;    &lt;a href=\&quot;LEDOff\&quot;&gt;&lt;button&gt;OFF&lt;/button&gt;&lt;/a&gt;&lt;/p&gt;&quot;;
 //make the LED pins output and initially turned off
 pinMode(LEDUnsetPin, OUTPUT);
 digitalWrite(LEDUnsetPin, LOW);
 pinMode(LEDSetPin, OUTPUT);
 digitalWrite(LEDSetPin, LOW);

 delay(1000);
 Serial.begin(115200);
 WiFi.begin(ssid, password); //begin WiFi connection
 Serial.println(&quot;&quot;);

 // Wait for connection
 while (WiFi.status() != WL_CONNECTED) {
   delay(500);
   Serial.print(&quot;.&quot;);
 }
 Serial.println(&quot;&quot;);
 Serial.print(&quot;Connected to &quot;);
 Serial.println(ssid);
 Serial.print(&quot;IP address: &quot;);
 Serial.println(WiFi.localIP());

 server.on(&quot;/&quot;, [](){
   server.send(200, &quot;text/html&quot;, page);
 });

 //turn on the on pin and turn off the off pin
 server.on(&quot;/LEDOn&quot;, [](){
   server.send(200, &quot;text/html&quot;, page);
   digitalWrite(LEDSetPin, HIGH);
   delay(10);
   digitalWrite(LEDSetPin, LOW);
   delay(10);
 });

 //turn off the on pin and turn on the off pin
 server.on(&quot;/LEDOff&quot;, [](){
   server.send(200, &quot;text/html&quot;, page);
   digitalWrite(LEDUnsetPin, HIGH);
   delay(10);
   digitalWrite(LEDUnsetPin, LOW);
   delay(10);
 });
 server.begin();
 Serial.println(&quot;Web server started!&quot;);
}

void loop(void){
 server.handleClient();
}
</code></pre>
