Show Posts
Pages: [1] 2 3
1  Using Arduino / LEDs and Multiplexing / Re: LED not turning off completely on: March 16, 2014, 10:47:17 pm
mHo2

Thank you for the response here is pictures of my setup.
https://drive.google.com/file/d/0B18p7MRACKchVlhsUFIwV3RJWHZWd0pLY1VhUGpzQVdhdjJz/edit?usp=sharing

https://drive.google.com/file/d/0B18p7MRACKchTnNzMlRLVVZpWlBWSlNlOTFNYk5lZjZiNWRF/edit?usp=sharing
2  Using Arduino / LEDs and Multiplexing / LED not turning off completely on: March 16, 2014, 04:09:37 pm
Hey guys!
Sorry if this is not the right place but im having a little problem controling an led
Here is my code..... Also see video below for a preview on whats going on.....
Code:
#include <SPI.h>
#include <Ethernet.h>

int led = 8;
String POST = "";
String SET = "";

// 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 };
IPAddress ip(192,168,5,177);

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

void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
  pinMode(led, OUTPUT);
}


void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  digitalWrite(led, HIGH);
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // 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 (c == '\n' && currentLineIsBlank) {
          // it is after the double cr-lf that the variables are
          // read another line!
          String POST = "";
          while(client.available())
          {
            c = client.read();
            // save the variables somewhere
            POST += c;
          }
          if(POST != "")
          {
            if(POST == "led=1"){
              SET = "on";
              Serial.println("on");
            }else{
              SET = "off";
              Serial.println("off");
            }
          }
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connnection: close");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html><head><title>LED Control</title>");
          client.println("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />");
          client.println("<link href='http://fonts.googleapis.com/css?family=Fjord+One' rel='stylesheet' type='text/css'>");
          client.println("<style>*{font-family:'Fjord One';}body{background-color:#f2f2f2;}h1{color:#222;}</style>");
          client.println("</head><body><h1>LED Control</h1>");
          client.print("<form method='post'>");
          client.print("<input type=\"radio\" name=\"led\" value=\"0\" onclick=\"this.form.submit()\"");
        
          if(SET != "on"){
           client.print(" checked");
          }
        
          client.print(">Off<br />");
          client.print("<input type=\"radio\" name=\"led\" value=\"1\" onclick=\"this.form.submit()\"");
        
          if(SET == "on"){
           client.print(" checked");
          }
        
          client.print(">On<br />");
          client.print("</form>");
          client.println("</body></html>");
          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);
    // close the connection:
    client.stop();
    Serial.println("client disonnected");
  }
 
  if(SET == "on"){
    digitalWrite(led, HIGH);
  }else{
    digitalWrite(led, LOW);
  }
}

https://www.youtube.com/watch?v=GrdNRUpxZBE
3  Using Arduino / Programming Questions / Re: Ethernet if else statement not working...? on: November 01, 2013, 10:54:30 pm
I changed my code to what you recommended (see below) and this is what i got......


Hyou have 1 new message!Tyou have 1 new message!Tyou have 1 new message!Pyou have 1 new message!/no messages1you have 1 new message!.no messages1you have 1 new message! no messages4you have 1 new message!0no messages4you have 1 new message! no messagesNyou have 1 new message!oyou have 1 new message!tyou have 1 new message! no messagesFyou have 1 new message!oyou have 1 new message!uyou have 1 new message!nyou have 1 new message!dyou have 1 new message!
no messages
no messagesDyou have 1 new message!ayou have 1 new message!tyou have 1 new message!eyou have 1 new message!:you have 1 new message! no messagesSyou have 1 new message!ayou have 1 new message!tyou have 1 new message!,no messages no messages0no messages2you have 1 new message! no messagesNyou have 1 new message!oyou have 1 new message!vyou have 1 new message! no messages2you have 1 new message!0no messages1you have 1 new message!3you have 1 new message! no messages0no messages3you have 1 new message!:you have 1 new message!5you have 1 new message!6you have 1 new message!:you have 1 new message!3you have 1 new message!7you have 1 new message! no messagesGyou have 1 new message!Myou have 1 new message!Tyou have 1 new message!
no messages
no messagesSyou have 1 new message!eyou have 1 new message!ryou have 1 new message!vyou have 1 new message!eyou have 1 new message!ryou have 1 new message!:you have 1 new message! no messagesAyou have 1 new message!pyou have 1 new message!ayou have 1 new message!cyou have 1 new message!hyou have 1 new message!eyou have 1 new message!
no messages
no messagesVyou have 1 new message!ayou have 1 new message!ryou have 1 new message!yyou have 1 new message!:you have 1 new message! no messagesAyou have 1 new message!cyou have 1 new message!cyou have 1 new message!eyou have 1 new message!pyou have 1 new message!tyou have 1 new message!-no messagesEyou have 1 new message!nyou have 1 new message!cyou have 1 new message!oyou have 1 new message!dyou have 1 new message!iyou have 1 new message!nyou have 1 new message!gyou have 1 new message!
no messages
no messagesCyou have 1 new message!oyou have 1 new message!nyou have 1 new message!nyou have 1 new message!eyou have 1 new message!cyou have 1 new message!tyou have 1 new message!iyou have 1 new message!oyou have 1 new message!nyou have 1 new message!:you have 1 new message! no messagescyou have 1 new message!lyou have 1 new message!oyou have 1 new message!syou have 1 new message!eyou have 1 new message!
no messages
no messagesCyou have 1 new message!oyou have 1 new message!nyou have 1 new message!tyou have 1 new message!eyou have 1 new message!nyou have 1 new message!tyou have 1 new message!-no messagesTyou have 1 new message!yyou have 1 new message!pyou have 1 new message!eyou have 1 new message!:you have 1 new message! no messagestyou have 1 new message!eyou have 1 new message!xyou have 1 new message!tyou have 1 new message!/no messageshyou have 1 new message!tyou have 1 new message!myou have 1 new message!lyou have 1 new message!;you have 1 new message! no messagescyou have 1 new message!hyou have 1 new message!ayou have 1 new message!ryou have 1 new message!syou have 1 new message!eyou have 1 new message!tyou have 1 new message!=you have 1 new message!Iyou have 1 new message!Syou have 1 new message!Oyou have 1 new message!-no messages8you have 1 new message!8you have 1 new message!5you have 1 new message!9you have 1 new message!-no messages1you have 1 new message!
no messages
no messages
no messages
no messages<you have 1 new message!hyou have 1 new message!1you have 1 new message!>you have 1 new message!4you have 1 new message!0no messages4you have 1 new message!:you have 1 new message! no messagesFyou have 1 new message!iyou have 1 new message!lyou have 1 new message!eyou have 1 new message! no messagesNyou have 1 new message!oyou have 1 new message!tyou have 1 new message! no messagesFyou have 1 new message!oyou have 1 new message!uyou have 1 new message!nyou have 1 new message!dyou have 1 new message!<you have 1 new message!/no messageshyou have 1 new message!1you have 1 new message!>you have 1 new message!







Code:

/*
  DNS and DHCP-based Web client
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 */

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

// Enter a MAC address for your controller below.
byte mac[] = {  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
char serverName[] = "www.donavonscreativeinnovations.com";


String location = "test.txt";

// Initialize the Ethernet client library
EthernetClient client;

void setup() {
  // start the serial library:
  Serial.begin(9600);
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  //~~~~~// Serial.println("connecting...");

  // if you get a connection, report back via serial:
 
  if (client.connect(serverName, 80)) {
   //~~~~~//  Serial.println("connected");
    // Make a HTTP request:
    client.println("GET /test.txt HTTP/1.0");
    client.println();
  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
     Serial.print(c);
 
 
           if ((c) >= '1'){
 // if the value from c = something more then 1 of equial to one then print the following
             Serial.print("you have 1 new message!");
   
     }
     
         else {
 // if the value from c = something less then 1 then print the following
     
           Serial.print("no messages");
     }   
  } 
       
  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
   //~~~~~// Serial.println("disconnecting.");
    client.stop();

    // do nothing forevermore:
    while(true);
  }
}




IMHO replace
Code:
client.println("GET http://www.donavonscreativeinnovations.com/test.txt");
with
Code:
client.println("GET /test.txt HTTP/1.0");
4  Using Arduino / Programming Questions / Re: Ethernet if else statement not working...? on: November 01, 2013, 12:04:39 pm
Thank you K5CZ for you response, I will give this a try....I think i may have tried this all ready don't remember off hand. I will keep everyone posted on how it works out tonight.


IMHO replace
Code:
client.println("GET http://www.donavonscreativeinnovations.com/test.txt");
with
Code:
client.println("GET /test.txt HTTP/1.0");
5  Using Arduino / Programming Questions / Re: Ethernet if else statement not working...? on: November 01, 2013, 12:02:38 pm
The problem i am having is when i upload to the arduino and i view the serial output it will say "you have 1 new message!" regardless of the value within the file.... so in other words if the value in the text file is 0 the script will still print you have 1 new message! and if you have a value of say 3 it will still print you have 1 new message! or if you have nothing or a 0 (zero) in the text folder it will still print you have 1 new message!.

What i want it to do is

if the value is equal to or greater then 1
     Print "you have 1 new message!"
it if is less then 1
   print "You don't have any messages at this time"


What is your actual problem ?
6  Using Arduino / Programming Questions / Ethernet if else statement not working...? on: October 31, 2013, 09:48:04 pm
Hey guys im back at this project again after a little break.
i have added some notes to the code along the way.

Here is what im running into now. I have switched from a .php file to a .txt file thinking that may help. (it did not seam to make a difference)
i am thinking there is some sort of programming issue with the if else state meant seeing how the c print work just fine..... any ideas?


Code:

/*
  DNS and DHCP-based Web client
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 */

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

// Enter a MAC address for your controller below.
byte mac[] = {  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
char serverName[] = "www.donavonscreativeinnovations.com";


String location = "test.txt";

// Initialize the Ethernet client library
EthernetClient client;

void setup() {
  // start the serial library:
  Serial.begin(9600);
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  //~~~~~// Serial.println("connecting...");

  // if you get a connection, report back via serial:
 
  if (client.connect(serverName, 80)) {
   //~~~~~//  Serial.println("connected");
    // Make a HTTP request:
    client.println("GET http://www.donavonscreativeinnovations.com/test.txt");
    client.println();
  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
     Serial.print(c);
 
 
           if ((c) >= 1){
 // if the value from c = something more then 1 of equial to one then print the following
             Serial.print("you have 1 new message!");
   
     }
     
         else {
 // if the value from c = something less then 1 then print the following
     
           Serial.print("no messages");
     }   
  } 
       
  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
   //~~~~~// Serial.println("disconnecting.");
    client.stop();

    // do nothing forevermore:
    while(true);
  }
}


7  Using Arduino / Networking, Protocols, and Devices / Re: LED will not turn on and off with Ethernet shild on: May 03, 2013, 10:37:24 pm
here is what i have now.

I have the value set on the website to 0

serial outputs

connecting...
connected
disconnecting.
HYou Have New App Request! # Of Request:Hdisconnecting.
TYou Have New App Request! # Of Request:Tdisconnecting.
TYou Have New App Request! # Of Request:Tdisconnecting.
PYou Have New App Request! # Of Request:Pdisconnecting.
/You Have New App Request! # Of Request:/disconnecting.
1You Have New App Request! # Of Request:1disconnecting.
.You Have New App Request! # Of Request:.disconnecting.
1You Have New App Request! # Of Request:1disconnecting.
 You Have New App Request! # Of Request: disconnecting.
4You Have New App Request! # Of Request:4disconnecting.
0You Have New App Request! # Of Request:0disconnecting.
4You Have New App Request! # Of Request:4disconnecting.
 You Have New App Request! # Of Request: disconnecting.
NYou Have New App Request! # Of Request:Ndisconnecting.
oYou Have New App Request! # Of Request:odisconnecting.
tYou Have New App Request! # Of Request:tdisconnecting.
 You Have New App Request! # Of Request: disconnecting.
FYou Have New App Request! # Of Request:Fdisconnecting.
oYou Have New App Request! # Of Request:odisconnecting.
uYou Have New App Request! # Of Request:udisconnecting.
nYou Have New App Request! # Of Request:ndisconnecting.
dYou Have New App Request! # Of Request:ddisconnecting.

You Have New App Request! # Of Request:
disconnecting.

You Have New App Request! # Of Request:
disconnecting.
DYou Have New App Request! # Of Request:Ddisconnecting.
aYou Have New App Request! # Of Request:adisconnecting.
tYou Have New App Request! # Of Request:tdisconnecting.
eYou Have New App Request! # Of Request:edisconnecting.


Also my LED is on but its not full power it only has 2.5 volts it looks like its ruining on 1 volt


Here is the updated code.
Code:
#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address for your controller below.
byte mac[] = {  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
char serverName[] = "www.donavonscreativeinnovations.com";


String location = "/arduino/display.php";

// Initialize the Ethernet client library
EthernetClient client;

void setup() {
  // start the serial library:
  Serial.begin(9600);
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("connecting...");

  // if you get a connection, report back via serial:
 
  if (client.connect(serverName, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
client.println("GET /arduino/display.php HTTP/1.0");
client.println();
  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
     Serial.print(c);
 
  if ((c) >= 1)
{
  Serial.print("You Have New App Request! # Of Request:");
  Serial.print(c);
digitalWrite(2, HIGH);
}
else
{
Serial.print("You Have No Request :");
digitalWrite(2, LOW);
}
 
       
  } 
       
  // if the server's disconnected, stop the client:
  //if (!client.connected()) {
   // Serial.println();
   Serial.println("disconnecting.");
  //  client.stop();

    // do nothing forevermore:
  //  while(true);
  delay(1000);
 // }
}
8  Using Arduino / Networking, Protocols, and Devices / LED will not turn on and off with Ethernet shild on: May 03, 2013, 09:54:33 pm
Hey guys!
I have been trying to get this code working for over a week and a half and i can not seam to find out what im doing wrong??!?!?!?!
For some reason the LED will not turn on or off depending on the value from the web! could some help me please!!!


Code:

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

// Enter a MAC address for your controller below.
byte mac[] = {  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
char serverName[] = "www.donavonscreativeinnovations.com";


String location = "/arduino/display.php";

// Initialize the Ethernet client library
EthernetClient client;

void setup() {
  // start the serial library:
  Serial.begin(9600);
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  //~~~~~// Serial.println("connecting...");

  // if you get a connection, report back via serial:
  
  if (client.connect(serverName, 80)) {
   //~~~~~//  Serial.println("connected");
    // Make a HTTP request:
    client.println("GET http://www.donavonscreativeinnovations.com/arduino/display.php");
    client.println();
  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
     // Serial.print(c);
  
  if ((c) >= 1)
{
  Serial.print("You Have New App Request! # Of Request:");
  Serial.print(c);
digitalWrite(2, HIGH);
}
else
{
Serial.print("You Have No Request :");
digitalWrite(2, LOW);
}
  
      
  }  
      
  // if the server's disconnected, stop the client:
  //if (!client.connected()) {
   // Serial.println();
   //~~~~~// Serial.println("disconnecting.");
  //  client.stop();

    // do nothing forevermore:
  //  while(true);
  delay(1000);
 // }
}

9  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Ethernet Shild on: April 25, 2013, 10:48:46 pm
latest update.
10  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Ethernet Shild on: April 24, 2013, 09:08:57 pm
seamed to be a kinda pointless test but here is what i came up with...... (still can not control an led from the Ethernet shield. )


Better client test 9/22/12
Send an e in serial monitor to test
connected
HTTP/1.1 200 OK
Date: Thu, 25 Apr 2013 02:06:33 GMT
Server: Apache
Last-Modified: Sat, 13 Nov 2010 16:31:40 GMT
Accept-Ranges: bytes
Content-Length: 51
Connection: close
Content-Type: text/plain; charset=UTF-8

Woohoo! Your arduino ethernet client works!
zoomkat
disconnecting.
==================







Some client test code.

Code:
//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields
//remove SD card if inserted

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

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

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600);
  Serial.println("Better client test 9/22/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  } 
}

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

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println("Host: web.comporium.net");
    client.println(); //end of get request
  }
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}

11  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Ethernet Shild on: April 23, 2013, 10:23:27 pm
forgot to re-post the code for my last post.


Code:
/*
  DNS and DHCP-based Web client
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 */

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

// Enter a MAC address for your controller below.
byte mac[] = {  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
char serverName[] = "www.donavonscreativeinnovations.com";


String location = "/arduino/display.php";

// Initialize the Ethernet client library
EthernetClient client;

void setup() {
  // start the serial library:
  Serial.begin(9600);
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  //~~~~~// Serial.println("connecting...");

  // if you get a connection, report back via serial:
 
  if (client.connect(serverName, 80)) {
   //~~~~~//  Serial.println("connected");
    // Make a HTTP request:
    client.println("GET http://www.donavonscreativeinnovations.com/arduino/display.php");
    client.println();
  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
     // Serial.print(c);
 
  if ((c) >= 1)
{
  Serial.print("You Have New App Request! # Of Request:");
  Serial.print(c);
digitalWrite(2, HIGH);
}
else
{
Serial.print("You Have No Request :");
digitalWrite(2, LOW);
}
 
       
  } 
       
  // if the server's disconnected, stop the client:
  //if (!client.connected()) {
   // Serial.println();
   //~~~~~// Serial.println("disconnecting.");
  //  client.stop();

    // do nothing forevermore:
  //  while(true);
  delay(1000);
 // }
}
12  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Ethernet Shild on: April 23, 2013, 10:09:37 pm
well i have tried some different pins and i have the exact same results on all the pins. any ideas?
13  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Ethernet Shild on: April 22, 2013, 11:28:39 pm
Thanks guys for the input i got it working but im needing to change a few things.  I have an led connected to Pin 1. Right now i have the number on the website set to 0, for some reason my if statement is not working.
could you tell me what im doing wrong? also i would like this to refresh and recheck every 60sec how would i do this?

Note: i removed the correct domain name, how ever on the correct page there is no html or code or anything its just a 0.

Here is my code.

Code:
/*
  DNS and DHCP-based Web client
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 */

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

// Enter a MAC address for your controller below.
byte mac[] = {  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
char serverName[] = "www.domainname.com";


String location = "/arduino/display.php";

// Initialize the Ethernet client library
EthernetClient client;

void setup() {
  // start the serial library:
  Serial.begin(9600);
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  //~~~~~// Serial.println("connecting...");

  // if you get a connection, report back via serial:
 
  if (client.connect(serverName, 80)) {
   //~~~~~//  Serial.println("connected");
    // Make a HTTP request:
    client.println("GET http://www.domainname.com/arduino/display.php");
    client.println();
  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
     // Serial.print(c);
 
  if ((c) > 1)
{
  Serial.print("You Have New App Request! # Of Request:");
  Serial.print(c);
digitalWrite(2, HIGH);
}
else
{
Serial.print("You Have No Request :");
digitalWrite(2, LOW);
}
 
       
  } 
       
  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
   //~~~~~// Serial.println("disconnecting.");
    client.stop();

    // do nothing forevermore:
    while(true);
  }
}
14  Using Arduino / Networking, Protocols, and Devices / Arduino Ethernet Shild on: April 21, 2013, 09:22:24 pm
Hey guys!
I just got my ethernet shild, i got it working and all but new im trying to display content from the website in my serial screen and its not working could you help me out?

Here is what i get right now.....


connecting...
connected
0
disconnecting.

Here is my code


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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
char serverName[] = "www.donavonscreativeinnovations.com/arduino/display.php";

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("connecting...");

  // if you get a connection, report back via serial:

  if (client.connect(serverName, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
     Serial.print(client);
    client.println();
  }
  else {
    // kf you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();

    // do nothing forevermore:
    while(true);
  }
}
15  Using Arduino / LEDs and Multiplexing / Led light sound help on: March 24, 2013, 10:22:13 pm
Hey guys
Sorry if this is in the wrong spot.

Here is my project...
I just bought 5m of Rgb led strip and i want to make this sound controlled. I have been looking on youtube and all and everyone seams to be just hooking the neg and pos to the speaker out puts and using it this way. It seams to me that this is not a good idea for many reasons one being depending one the amount of Leds I have may and will change the ohms and not be comparable with the amps ohms along with the fact that if the music is not loud enough then they simply won't light up.

From my research and thoughts on the subject what i would like to do is have an external power source for the Leds this way they get the exact voltage every time.

Could i hook up a mosfet (mossfet?) to the speaker and use it to switch on and off my 12v power lead for the Leds?

Also if I did that how could I get different colors to light up? Would I need to run a second set of wires from another say a tweeter(as a second) (and a sub as one) to make a different color happen?
Pages: [1] 2 3