Web Relay Control / SwitchRelay

Hello,

i found this progra, from Marvin Stuart.

After Compile i get always following Issue- message: I installed all libaries, also i installed the webduino as webduino and not as webduino-master. (both is not working). Can somebode help me?


C:\Users\kuntze\Documents\Arduino\Licht\Licht\Licht.ino:104:1: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]

^

C:\Users\kuntze\Documents\Arduino\Licht\Licht\Licht.ino: In function ‘void settingsPage(WebServer&, WebServer::ConnectionType)’:

Licht:205: error: no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘const char [2]’)

server << " ";

^

Licht:207: error: no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘const char [6]’)

server << "
";

^

Licht:209: error: no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘const char [45]’)

server << “”;

^

C:\Users\kuntze\Documents\Arduino\Licht\Licht\Licht.ino: In function ‘void displayPins(WebServer&, int, int, String, bool)’:

Licht:325: error: no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘String’)

server << label;

^

Licht:339: error: no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘const char [12]’)

server << “”;

^

Licht:345: error: no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘const char [12]’)

server << “”;

^

Licht:356: error: no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘const char*’)

server << (!val ? “Off” : “On”);

^

Licht:360: error: no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘const char*’)

server << (val ? “On” : “Off”);

^

Licht:366: error: no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘const char [29]’)

server << “n/a”;

^

Licht:371: error: no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘const char [6]’)

server << "
";

^

exit status 1
no match for ‘operator<<’ (operand types are ‘WebServer’ and ‘const char [2]’)


marvinstuart/switchrelay
Code
Issues 1
Pull requests 0
Pulse
Graphs
switchrelay/lightpower
0972286 on 7 Nov 2014
@marvinstuart marvinstuart Update lightpower
1 contributor
468 lines (426 sloc) 15 KB
/*
This application will run on a Arduino with a WizArd compatible ethernet shield.
The Arduino will server up a jQuery enhanced website using webduino for switching on and off relays
The relays can be connected to any number of applications. Most Specific it was intended
for remote automation of utility main’s power for home automation.

You will need the webduino library in your Arduino /library folder to compile;
built in Arduino 1.5.4 and webduino 1.7 (you will need to restart IDE to load)

The application also has functionality for Push Button, which is essentially a pulse rather
then a latch of a relay, this is useful for hooking up to items that need turned on and off
with a time delay on the power button.

This code assumes the use of a 2x2 or 1x4 optio-isolator relay module. for a max of 7 relays
(I am out of memory in default code to add more) Any use of high voltage or damage to your hardware is not my fault.
I assume no risk or responsibility for the quality of this code.

To enable auth look below and change the settings accordingly. you will need to base 64 encode your creds.

Currently I am not saving the Port Name to EEPROM, if you have suggestions on how to accomplish
this quickly let me know, I just haven’t done it yet… until then you can edit the relayUse array below
change ‘Undefined’ To your port name after reboot, Port1,Port2… etc.

To use this, enter the following USLs into your browser.
Replace “host” with the IP address assigned to the Arduino. (variables below)

http://host/

These URLs brings up a display of the values READ on digital pins
This is done with a call to defaultCmd.

http://host/webpower

This URL also brings up a display of the values READ on digital pins
But it’s done as a form, by the “formCmd” function,
and the digital pins are shown as radio buttons you can change.
When you click the “Submit” button, it does a POST that sets the
digital pins, re-reads them, and re-displays the form.

http://host/settings

This URL will assign the pins to relays, by default all relays are disabled
this pin to relay information is stored on your Arduino EEPROM
Note: 255 is the default and that means the Item is not active.

i found this progra

Post YOUR code. The compiler is NOT compiling Marvin Stuart's code. It is compiling YOUR code.

Post links to all of the libraries YOU downloaded.

Please read #7 below:

http://forum.arduino.cc/index.php/topic,148850.0.html

Also, we are still waiting for the links to the libraries that were requested.

https://github.com/marvinstuart/switchrelay (There is written all Libaries)

Libarie: https://github.com/sirleech/Webduino

You have posted code without using code tags. This creates certain problems and obstacles for other forum members. The code tags make the code look

like this

when posting source code files. It makes it easier to read, and can be copied with a single mouse click.
If you have already posted without using code tags, open your message and select “modify” from the pull down menu labelled, “More”, at the lower left corner of the message. Highlight your code by selecting it (it turns blue), and then click on the “</>” icon at the upper left hand corner. Click on the “Save” button. Code tags can also be inserted manually in the forum text using the [code] and [/code] metatags.

When you are finished that, please read these two posts:

How to use this forum - please read.
and
Read this before posting a programming question …

OK, thank you, i found. But i cant input the code, cause the forum in fenced of 9000 signs. The code have douple. So i put the programm as *.ino file on it. Hope it helps.

Licht.ino (15 KB)

gitarrist1981:
OK, thank you, i found. But i cant input the code, cause the forum in fenced of 9000 signs. The code have douple. So i put the programm as *.ino file on it. Hope it helps.

That’s great, thanks. Please delete the now useless posts above.

Your problems begin here:

P(htmlHead) =
"<!DOCTYPE html><html><head>"
"<title>PowerSwitch</title>"
"<meta name='viewport' content='width=device-width, initial-scale=3'>"
//...

How did you download the code? Copy and paste? Try downloading the zip file instead.

Yes, with copy and paste. By downloading the zip file, arduino software was not able to read. Here is the file from the zip.

lightpower.ino (15 KB)

You are correct. It's a lame, useless pretense at a software package. Take up the issue with the author.

I did, no answer… :confused:

So i tryed another one, thats work very well but from graphics not so nice. Anyway. The problem by that is, if i press a button, the arduino uno R3 needs good 5 seconds before he switch LED on or off. Thats not really usefull.

So i dont know if the board is to slow or is the software waste ?

Ether_Relay.ino (20.3 KB)

Read the code and find out.

:o The code is correct (say the compliler)... Did i told im beginner?

Nobody here is going to debug code that you didn't write, for free. Not 21kb of it. If it was your code, you might have some takers. The purpose of this forum is learning. What would you learn from that?

Anyway. The problem by that is, if i press a button, the arduino uno R3 needs good 5 seconds before he switch LED on or off. Thats not really usefull.

Simple web server code that controls a pin on the arduino.

//zoomkat 10-6-13
//simple button GET with iframe code
//open serial monitor to see what the arduino receives
//use the ' instead of " in html ilnes 
//address will look like http://192.168.1.102:84/ when submited
//for use with W5100 based ethernet shields

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //ethernet shield mac address
byte ip[] = { 192, 168, 1, 102 }; // arduino IP in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port

String readString; 

//////////////////////

void setup(){

  pinMode(4, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  server.begin();

  //enable serial data print 
  Serial.begin(9600); 
  Serial.println("servertest1"); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 
          //Serial.print(c);
        } 

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.println(readString); //print to serial monitor for debuging 

          //now output HTML data header
             if(readString.indexOf('?') >=0) { //don't send new page
               client.println("HTTP/1.1 204 Zoomkat\r\n\r\n");
             }
             else {
          client.println("HTTP/1.1 200 OK"); //send new page
          client.println("Content-Type: text/html");
          client.println();

          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>Arduino GET test page</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>Zoomkat's simple Arduino button</H1>");
          
          client.println("<a href='/?on1' target='inlineframe'>ON</a>"); 
          client.println("<a href='/?off' target='inlineframe'>OFF</a>"); 

          client.println("<IFRAME name=inlineframe style='display:none'>");          
          client.println("</IFRAME>");

          client.println("</BODY>");
          client.println("</HTML>");
             }

          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf("on1") >0)//checks for on
          {
            digitalWrite(4, HIGH);    // set pin 4 high
            Serial.println("Led On");
          }
          if(readString.indexOf("off") >0)//checks for off
          {
            digitalWrite(4, LOW);    // set pin 4 low
            Serial.println("Led Off");
          }
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

What is html ilnes? A virus?

I like to learn to use the programming in right way. With this program is all working yes, but even not right. I will tell my idea:

I like to control my homelight with an adruino with webshield and relays. I can already all control with the webpage.

Now i was thinking to control the lights also like normaly with buttons in the wall. So i wrote in the code the buttoncontrol wich i found in different topics.

If i press now the button, nothing happend. If i press the Button > 5 seconds, the LED shine. If i press with the webpage, the LED shined without delay.

I searched and searched about, but nowhere i found what i done wrong. I found integer, #defines, const etc.... I tryed all.... but the buttoncontrol is still with a delay of 5 seconds... So im sure, something i did wrong, or?

Thanks for reply.

Your complaint of a slow response is also in a posting before zoomkat's. So what code are you referring to above, that you have modified? The libraries you tried before, or zoomkat's code?

If you have modified zoomkat's code, please post the modified code, in code tags.

aarg: What is html ilnes? A virus?

Yes, it is a brain teaser. 8)