Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / arduino + jquery mobile + SD on: February 08, 2013, 11:59:02 am
Hi my name is Nikos and i want to ask i you can help me to have my first demo site with jquery and on/off swithes. I did a UI for it but i dont know how to put it in the write order and run it on arduino from SD. Can you help me.

This is an example and i want to ask you if you can make the first switch to trigger for me and i will do the rest thanks again for you precious time.
Code:

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Home Automation v.1</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>

<body>

<div data-role="page">

<div data-role="header">
<h1>Home Automation</h1>
</div><!-- /header -->

<div data-role="collapsible-set">

<div data-role="collapsible" data-collapsed="false" data-theme="b">
<h3>Lights</h3>

<div data-role="content">
<label for="flip-1">Light 1</label>
<select name="flip-1" id="flip-1" data-role="slider">
<option value="off">Off</option>
<option value="on">On</option>
</select>

<label for="flip-2">Light 2</label>
<select name="flip-2" id="flip-2" data-role="slider">
<option value="off">Off</option>
<option value="on">On</option>
</select>

<label for="flip-3">Light 3</label>
<select name="flip-3" id="flip-3" data-role="slider">
<option value="off">Off</option>
<option value="on">On</option>
</select>

<label for="flip-4">Light 4</label>
<select name="flip-4" id="flip-4" data-role="slider">
<option value="off">Off</option>
<option value="on">On</option>
</select>

</div>

</div>


</div><!-- /content -->

<div data-role="footer" data-position="fixed">
<h4>nikkpap & duckdodgers - Copyright 2013</h4>
</div><!-- /footer -->

</div><!-- /page -->

</body>
</html>
2  Topics / Home Automation and Networked Objects / Re: Arduino UNO + Seeed Relay Shield + RN-XV on: July 10, 2012, 04:16:23 pm
bravo nice keep up my arduino friend  smiley
3  Topics / Home Automation and Networked Objects / Re: Operate from Blackberry/Android/Iphone-Ipad/Nokia/PC/Mac across the Globe W/O PC on: July 10, 2012, 04:12:49 pm
i have to say very nice UI but very slow i tried to modify little bit like to use background-color grey instead of png i did a png reduce but still very slow.

can someone make faster...? any ideas?? can we add all the spare digital pins  too ? and how? i cant even change the led names if i do this i lost the on of png...

and something last nice round png but its more easy to draw a cicle or a square like RED on OFF and Green or Blue on ON ?????? thanks for your effort keep up.... bravo
4  Using Arduino / Project Guidance / Re: Ethernet Shield Web Server All Pins Different names on: July 10, 2012, 04:04:34 pm
mister nick the only thing you do is to play referee "do this , do that"  dont forget i am FROM GREECE so i am GREEK it's not my mother lang and i am still trying to communicate and  "rich up" my knowledge , so mister nick if you have something to say like a simple guide or correction yeap you are welcome.

but if you only do this just cause you have time to spent please its helpless.

Thanks in Advance this is only my opinion.

P.S. Yes this is the Final html code i like to use like a GUI Web site to control all my pins and read analog lm35 values and PIR and smoke sensor. this is my GOAL just to make i complete example fo others too cause i can learn from them more easy like common non programmer minds.
 
5  Using Arduino / Project Guidance / Re: Ethernet Shield Web Server All Pins Different names on: July 08, 2012, 11:14:03 am
hi thanks for the replay, the think is i dont really care if it is a matrix or not, i notice that i cant do it in the matrix way this is the reason i am asking cause i am a n00b i am a civil engineer not a guru in C or html but i can handle it from the examples... so my goal is to make one big example of how to handle all the pins from sd via a html code - site. so i include that code just to ask you how i can do this ???
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Arduino Beta V1.0 </title>
</head>
<body>
<font face="arial">
<table width="480" height="640" border="1">
  <tr>
    <th height="78" colspan="3" scope="row" style="background-color:#FFA500">
      <h1><strong> Welcome to Ethernet Arduino Beta V1.0 ;)</strong></h1></th>
  </tr>
  <tr>
    <th height="116" scope="row" style="background-color:#FFD700"> <p><strong>Temperature</strong></p>
      <form name="TEMP" method="post" action="">
        <p></label><input type="radio" name="TEMP" value="LMC" id="LMC">LM35 C &nbsp;</label>
        <br><label><input type="radio" name="TEMP" value="LMD" id="LMD">LM35 DZ</label>
        <br><label><input type="radio" name="TEMP" value="BOTH" id="BOTH">Both</label></p>
      </form></th>
    <td width="141" style="background-color:#EEEEEE"><center><p><strong>LM35 C</strong></p>
    <h1><font color="#00FF00">   &#176C </font></h1>
      </p>
    </center></td>
    <td width="128" style="background-color:#EEEEEE"><center><p><strong>LM35 DZ</strong></p>
    <h1><font color="#00FF00">   &#176C </font></h1>
    </p>
    </center></td>
  </tr>
  <tr>
    <th height="315" scope="row" style="background-color:#FFD700">
    <p><strong>Ρελέ 1-4</strong></p>
      <form name="RELAY" method=get>
        <p>Led controller</p>
        <br>led1  <input type=submit name=led1 value=on> <input type=submit name=led1 value=off>
<br>led2  <input type=submit name=led2 value=on> <input type=submit name=led2 value=off>
<br>led3  <input type=submit name=led3 value=on> <input type=submit name=led3 value=off>
<br>led4  <input type=submit name=led4 value=on> <input type=submit name=led4 value=off>
<br>All   <input type=submit name=all  value=on> <input type=submit name=all  value=off>
</from>
     </form></th>
     <td colspan="2" style="background-color:#EEEEEE">
     <p>The <font face="arial">Led #1 is :</font></p>
     <p>The <font face="arial">Led #2 is :</font></p>
     <p>The <font face="arial">led #3 is :</font></p>
     <p>The <font face="arial">Led #4 is :</font></p></td>
  </tr>
  <tr>
    <th height="137" scope="row"style="background-color:#FFD700"><p>Movement Sensor PIR</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p></th>
    <td colspan="2" style="background-color:#EEEEEE"><p>&nbsp;</p></td>
  </tr>
  <tr>
    <th height="63" scope="row"style="background-color:#FFD700"><p>Smoke Sensor</p></th>
    <td colspan="2" style="background-color:#EEEEEE">
    <form name="SMOKER" method="post" action="">
      <label><input type="text" name="SR" id="SR"></label>ppm
    </form></td>
  </tr>
  <tr>
    <th width="177" height="101" scope="row"style="background-color:#FFD700"><p>Generar IR Sensor</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p></th>
    <td colspan="2" style="background-color:#EEEEEE">
    <form name="IRREDER" method="post" action="">
      <label><input type="text" name="IRR" id="IRR"></label>IR CODE
    </form>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p></td>
  </tr>
  <tr>
    <th height="23" colspan="3" scope="row"style="background-color:#FFA500"> Copyright © 2012 ALU Dev Team... @ <a target="_blank" href="http://www.support-plus.gr/">www.support-plus.gr</a></th>
</table>
</font>
</body>
</html>
6  Using Arduino / Project Guidance / Ethernet Shield Web Server All Pins Different names on: July 05, 2012, 07:30:54 pm
Hi. My goal is to control all the pins i have spare from the Ethernet shield like 3 to 9, i want to have buttons in the the html and different names like "lights" "door" "siren" "etc". Of course i care about the pins state so if i change PC or browser or just open the html (web server) after two days to know exactly the state of the pin.

i have a code to start i found a matrix way and a single way for one pin but the Q is can i make to work to my needs.

Thank you in Advance even if you don't answer i know the time is precious to all of us, now days...

Nikos Pap.
Infrastructure Engineer T.E.

**********************************************
               matrix way
**********************************************
Code:
#include <Ethernet.h>
#include <SPI.h>
//network NB: Pins 10, 11, 12 and 13 are reserved for Ethernet module.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 10, 10 };
byte gateway[] = { 192, 168, 10, 254 };
byte subnet[] = { 255, 255, 255, 0 };

String inString = String(35);

String Led;

int led[] = {00, 2, 3, 4 , 5, 6, 7, 8, 9  }; //Led pins num 0 in array is not used
int numofleds = 8; //Number of Leds
String value[] = {"on","on","on","on","on","on","on","on","on"}; //startup all led are off

Server server(80);
String data;
void setup()
{
  Serial.begin(115200);
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();
  
 //set pin mode
  for (int j= 1; j < (numofleds + 1); j++){
    pinMode(led[j], OUTPUT);
  }
  Serial.println("Serial READY");
  Serial.println("Ethernet READY");
  Serial.println("Server READY");
  Serial.println("info @ Support-Plus");
  Serial.println("");
  Serial.println("www.support-plus.gr");
}

void loop()
{
  Client client = server.available();
  
  if(client){
    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    while (client.connected()) {
    
      if(client.available()) {
      
        char c = client.read();
        // if we've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so we can send a reply
        if (inString.length() < 35) {
            inString.concat(c);
         }
        if (c == '\n' && current_line_is_blank) {
                    
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<html><body><form method=get>");
          client.println("<p>Led controller</p>");
        
         for(int i= 1; i < (numofleds + 1) ;i++){
           Led = String("led") + i;
          
          if(inString.indexOf(Led+"=on")>0 || inString.indexOf("all=on")>0){
            Serial.println(Led+"on");
            digitalWrite(led, HIGH);
            value = "off";
          }else if(inString.indexOf(Led+"=off")>0 || inString.indexOf("all=off")>0 ){          
            Serial.println(Led+"on");
            digitalWrite(led, LOW);
            value = "on";
          }
           client.println("<br>"+Led+"  <input type=submit name="+Led+" value="+value+">");
         }
         client.println("<br>All <input type=submit name=all value=on><input type=submit name=all value=off>");
         client.println("</from></html></body>");
          break;
        }
        if (c == '\n') {
          // we're starting a new line
          current_line_is_blank = true;
        } else if (c != '\r') {
          // we've gotten a character on the current line
          current_line_is_blank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    inString = "";
    client.stop();
  }
}
**********************************************
               one led below
**********************************************

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[]={192,168,0, 149};

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(80);

int LEDpin = 7;
String readString = String(30);
String state = String(3);

void setup()
{
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  
  //Sets the LEDpin as an output
  pinMode(LEDpin,OUTPUT);
  
  digitalWrite(LEDpin,LOW);
  state = "OFF";
}

void loop()
{
  // listen for incoming clients
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply

        if (readString.length() < 30) {
          readString.concat(c);
        }

        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          int LED = readString.indexOf("LED=");

          if (readString.substring(LED,LED+5) == "LED=T") {
            digitalWrite(LEDpin,HIGH);
            state = "ON";
          }
          else if (readString.substring(LED,LED+5) == "LED=F") {
            digitalWrite(LEDpin,LOW);
            state = "OFF";
          }
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          client.print("LED is ");
          client.print(state);
          client.print("<br><br>");
          
          if (state == "ON") {
            client.println("<a href=\"./?LED=F\">Turn Off<a>");
          }
          else {
            client.println("<a href=\"./?LED=T\">Turn On<a>");
          }
          
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    readString = "";
    // close the connection:
    client.stop();
  }
}
Pages: [1]