Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: interfacing arduino UNO with Ethernet shield and xbee shield on: February 24, 2013, 07:47:05 pm
sorry i didn't understand your answer how can i connect uno R3 with ethernet shield with xbee shield ? and how xbee shield send data to uno if not without SPI
2  Using Arduino / Networking, Protocols, and Devices / Re: interfacing arduino UNO with Ethernet shield and xbee shield on: February 24, 2013, 07:19:58 pm
how can i connect the Ethernet shield and xbee shield together on uno and they suppose use the same SPI ? 
3  Using Arduino / Programming Questions / Re: Interfacing program code for GSMsim900 with arduino and ADXL345 on: February 24, 2013, 05:44:52 pm
he means :
Code:
PUT UR CODE HERE NOT AS U DID !!!

4  Using Arduino / Programming Questions / Re: SD Card+ arduino Leonardo on: February 24, 2013, 05:42:27 pm
i think u have to format the sd card first by FAT-16 or FAT-32 ,by the way if u need to know how to open files from sd card ask me smiley
5  Using Arduino / Storage / Re: SD card problem on: February 18, 2013, 03:28:03 pm
thanks alot for your replys and your help i understand now smiley
6  Using Arduino / Storage / Re: SD card problem on: February 17, 2013, 09:40:38 pm
i solving it like 80 % here is the code just trial code to show pictures from with sd card on website
Code:

//zoomkat 1/26/13
//SD server slider test code
//open serial monitor to see what the arduino receives
//address will look like http://192.168.1.102:84/servosld.htm when submited
//for use with W5100 based ethernet shields
//put the servosld.htm, slider.js, bluev_sl.gif,
//and bluev_bg.gif on the SD card
//files at http://web.comporium.net/~shb/servoslider.htm page


#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>
String readString, pos;
int sensor;
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x80, 0xA2 };
byte ip[] = {
  192, 168, 1, 102 }; // 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

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

void setup(){

  Serial.begin(9600);
  pinMode(7,OUTPUT);
    pinMode(8,OUTPUT);
      pinMode(2,INPUT);
  // disable w5100 while setting up SD
  pinMode(10,OUTPUT);
  digitalWrite(10,HIGH);
  Serial.print("Starting SD..");
  if(!SD.begin(4)) Serial.println("failed");
  else Serial.println("ok");

  Ethernet.begin(mac, ip, gateway, gateway, subnet);

  //delay(2000);
  server.begin();
  Serial.println("Ready");
pinMode(7, OUTPUT); //pin selected to control
  pinMode(8, OUTPUT); //pin selected to control

}

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
         
         //select proper header for file to be sent to browser
         
          client.println("HTTP/1.1 200 OK"); //send new page
          if(readString.indexOf("index") >=0) {
          client.println("Content-Type: text/html");
          client.println(); }

       
           if(readString.indexOf("bk") >=0) {
          client.println("Content-Type: image/jpeg");
          client.println(); }
         
         
         
          if(readString.indexOf("bk") >=0) {
            File myFile = SD.open("bk.jpg");
            if (myFile) {
              while (myFile.available()) {
                client.write(myFile.read());
              }
              myFile.close();
            }
          }
         
          if(readString.indexOf("d1") >=0) {
          client.println("Content-Type: image/jpeg");
          client.println(); }
         
         
         
          if(readString.indexOf("d1") >=0) {
            File myFile = SD.open("d1.jpg");
            if (myFile) {
              while (myFile.available()) {
                client.write(myFile.read());
              }
              myFile.close();
            }
          }
         
          //select file to send to browser
          if(readString.indexOf("index") >= 0) {
            File myFile = SD.open("index.HTM");
            if (myFile) {
              while (myFile.available()) {
                client.write(myFile.read());
              }
              myFile.close();
            }
          }
          sensor=digitalRead(2);
         
   client.print(sensor);
         

         if(readString.indexOf('2') >0)//checks for 2
          {
            //state1="ON";
           
            digitalWrite(8, HIGH);    // set pin 8 high


          }

          if(readString.indexOf('3') >0)//checks for 3
          {
            //state1="OFF";
            digitalWrite(8, LOW);    // set pin 8 low

          }
         
          if(readString.indexOf('4') >0)//checks for 4
          {
            //state2="ON";
            digitalWrite(7, HIGH);    // set pin 7 high
           }

          if(readString.indexOf('5') >0)//checks for 5
          {
            //state2="OFF";
            digitalWrite(7, LOW);    // set pin 7 low
          }

          delay(1);
          //stopping client
          client.stop();
         
       
          readString="";
        }
      }
    }
  }
}


it worked good some how but when i press on ON button it lights the led but go to empty page so i must press back to the index.html
second problem the address now is 192.168.1.102:84/index.html i think it will make problem in port forwarding as i forward to port 84 only not 84/index.html how can i solve it ?

7  Topics / Home Automation and Networked Objects / Re: Why's SD -> Ethernet Card -> Webbrowser so slow? on: February 17, 2013, 09:14:23 pm
thanks alot really smiley
8  Using Arduino / Storage / Re: SD card problem on: February 17, 2013, 08:20:24 pm
i don't need scr as i used sd.open so i told the arduino to open it from the root of the sd card right ?
9  Using Arduino / Storage / Re: SD card problem on: February 17, 2013, 07:38:23 pm
Code:

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // 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;
String state1="LOW";
String state2="LOW";
//////////////////////

void setup(){

  Serial.begin(9600);
pinMode(7, OUTPUT); //pin selected to control
  pinMode(8, OUTPUT); //pin selected to control
  // disable w5100 while setting up SD
  pinMode(10,OUTPUT);
  digitalWrite(10,HIGH);
  Serial.print("Starting SD..");
  if(!SD.begin(4)) Serial.println("failed");
  else Serial.println("ok");

  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  digitalWrite(10,HIGH);

  //delay(2000);
  server.begin();
  Serial.println("Ready");

}

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
          if(readString.indexOf('2') >0)//checks for 2
          {
            state1="ON";
            digitalWrite(8, HIGH);    // set pin 8 high


          }

          if(readString.indexOf('3') >0)//checks for 3
          {
            state1="OFF";
            digitalWrite(8, LOW);    // set pin 8 low

          }
         
          if(readString.indexOf('4') >0)//checks for 4
          {
            state2="ON";
            digitalWrite(7, HIGH);    // set pin 7 high
           }

          if(readString.indexOf('5') >0)//checks for 5
          {
            state2="OFF";
            digitalWrite(7, LOW);    // set pin 7 low
          }
         
         
          client.println("HTTP/1.0 ok"); //send new page
          client.println("Content-Type: text/html");
          client.println();

          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>Smart Home Over IP</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>Smart Home Over IP<br><br><br></H1>");
         
         
          client.println("<H1>light 1</H1>");
            client.println("Light1 is ");
 
          client.println(state1);
 
          client.println("<br>");
          client.print("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on2'>");
          client.print("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off3'>");
         
         
          client.println("<H1>light 2</H1>");
          client.println("Light1 is ");
 
          client.println(state2);
 
          client.println("<br>");
          client.print("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on4'>");
          client.print("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off5'>");
       


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


          client.println("HTTP/1.1 200 OK"); //send new page
          //client.println("Content-Type: text/html");
          client.println("Content-Type: image/jpeg");
          //client.println("Content-Type: image/gif");
          //client.println("Content-Type: application/x-javascript");
          //client.println("Content-Type: text");
         
         

          //File myFile = SD.open("index.htm");
          File myFile = SD.open("on.jpg");
          //File myFile = SD.open("BLUEH_SL.GIF");
          //File myFile = SD.open("SERVOSLD.HTM");
          if (myFile) {
            //Serial.println("test.txt:");
            // read from the file until there's nothing else in it:
            while (myFile.available()) {
              client.write(myFile.read());
            }
            // close the file:
            myFile.close();
         
     


          }
     
   
            delay(1);
            //stopping client
            client.stop();
            readString="";
          //}
        }
      }
    }
  }
}





i want to make picture on.jpg appear on the webpage but it appears as  nothing like that

""—ñe–Y|›à˜Ù¡è¶šKU G¦ÀùÜYe—õèÇ‚Á aè¶Ô-Ƈ²þÖ‰Xù=à‡¦§P´{{/ð¯Œi—NV¡ŒðZ87Ñlêö\¿Å7e¤ºR¶5„1á¡‹Fúnu:—/ólø' øÇ43F‡Øju8QCý˜u걕ø‡ÝP&&=KÅ/õg…#>   ªHdn½-x/A¢c7/±ýŸÍÂR|X´—G„ D†:EάhÓS…/í:c&-wáž@BéUÂí±Pm5—xË=cDPÆ­KN”¿Á:1Rt¾<zJÓÑpP…:Ób£ÿŒJvXCÑ"­íiF¾‰·Ðï‡ðM¢äUq> F=#ú5¦6æ%è݃EBŽšÒÔp¯Ñ%^öÅO°²>x-‚ê>:‰¾‚iM   ÇþÇò «#sðvë,Á/´''""



any help please
10  Topics / Home Automation and Networked Objects / Re: Why's SD -> Ethernet Card -> Webbrowser so slow? on: February 17, 2013, 06:19:01 pm
hi ,
how you make arduino open webpage on sd card having pictures and open it .. i tried to do that for 2 days and failed at the end
any help please
11  Using Arduino / Storage / Re: SD card problem on: February 17, 2013, 06:11:38 pm
No it is arduino uno and i want to save html code in sd card to save memory and in that html code i want to add pictures
my question is how to do that ?
thanks for your help smiley
12  Using Arduino / Storage / SD card problem on: February 17, 2013, 05:35:08 pm
hi all ,
i have a problem with SD card i do alot of researches before posting but i didn't find a solution
all i want is to put pictures in my webpage so i save pictures on SD card and do index.html and do the website i want with pictures
but when i open the website pictures didn't appear !! although i did add to sd library and i use sd.open and everything !!!
can anyone know why ?
13  Using Arduino / Networking, Protocols, and Devices / Re: Webserver from SD card and picture problem on: February 16, 2013, 03:04:23 pm
Thanks for your advice ,,, but pictures downloading slowly when i open the webpage do u know why ?
14  Using Arduino / Networking, Protocols, and Devices / Re: Password protect my Ethernet Web Server - SOLVED on: November 25, 2012, 08:41:29 am
hi ,
i tried it in LAN so i didn't do port forwarding , i typed in browser 192.168.1.101:82

i want to add the password part to that code , when i tried that it gives my page to enter password when i entered it correctly it opened the page to control leds but when i press on anything nothing happens to leds and it opens the page of password again.
Code:

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // 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(5, OUTPUT); //pin selected to control
  pinMode(6, OUTPUT); //pin selected to control
  pinMode(7, OUTPUT); //pin selected to control
  pinMode(8, 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("server multi pin button test 1.0"); // 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

          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>");
         
          // For simple testing, pin 5, 6, 7, and 8 are used in buttons
          // DIY buttons
          client.println("<a href=/?on2 >ON</a>");
          client.println("<a href=/?off3 >OFF</a>");
          client.println("&nbsp;<a href=/?off357 >ALL OFF</a><br><br>");

          // mousedown buttons
          client.println("<input type=button value=ON onmousedown=location.href='/?on4'>");
          client.println("<input type=button value=OFF onmousedown=location.href='/?off5'>");       
          client.println("&nbsp;<input type=button value='ALL OFF' onmousedown=location.href='/?off3579'><br><br>");       
                   
          // mousedown radio buttons
          client.println("<input type=radio onmousedown=location.href='/?on6'>ON</>");
          client.println("<input type=radio onmousedown=location.href='/?off7'>OFF</>");
          client.println("&nbsp;<input type=radio onmousedown=location.href='/?off3579'>ALL OFF</><br><br>");   
   
         
          // custom buttons
          client.print("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on8'>");
          client.print("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off9'>");
          client.print("&nbsp;<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579'>");

          client.println("</BODY>");
          client.println("</HTML>");
 
          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf('2') >0)//checks for 2
          {
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("Led 5 On");
          }
          if(readString.indexOf('3') >0)//checks for 3
          {
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("Led 5 Off");
          }
         
          if(readString.indexOf('4') >0)//checks for 4
          {
            digitalWrite(6, HIGH);    // set pin 6 high
            Serial.println("Led 6 On");
          }
          if(readString.indexOf('5') >0)//checks for 5
          {
            digitalWrite(6, LOW);    // set pin 6 low
            Serial.println("Led 6 Off");
          }
         
           if(readString.indexOf('6') >0)//checks for 6
          {
            digitalWrite(7, HIGH);    // set pin 7 high
            Serial.println("Led 7 On");
          }
          if(readString.indexOf('7') >0)//checks for 7
          {
            digitalWrite(7, LOW);    // set pin 7 low
            Serial.println("Led 7 Off");
          }     
         
            if(readString.indexOf('8') >0)//checks for 8
          {
            digitalWrite(8, HIGH);    // set pin 8 high
            Serial.println("Led 8 On");
          }
          if(readString.indexOf('9') >0)//checks for 9
          {
            digitalWrite(8, LOW);    // set pin 8 low
            Serial.println("Led 8 Off");
          }         
             
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}


15  Using Arduino / Networking, Protocols, and Devices / Re: Password protect my Ethernet Web Server - SOLVED on: November 24, 2012, 09:40:23 am
hi,
i like your project so much but when i tried it , it didn't work smiley-sad
i will tell u what i have done:
first upload code to arduino uno and connect it to ehternet shield and i update my mac address
then write 192.168.1.101:82
it tells me webpage not available . i don't know why ?
i need the part of the password to my project so urgently.
thanks in advance
Pages: [1] 2