Show Posts
Pages: [1]
1  Topics / Home Automation and Networked Objects / Setting things up in Europe on: October 03, 2012, 09:45:01 am
I've been doing a lot of research about controlling x10 through arduino, but nearly all of it is specific to America, I was wondering if somebody could help clear somethings up for me for Europe, specifically Spain.

We operate on the 433Mhz frequency, so things like the 'firecracker' don't work here, is there are similar replacement for this that will work here? Or could I use a simple, normal 433Mhz RF transmitter?

Also, is there any specific x10 transceiver I must use? Or is the ability to receive RF messages enough?

My aim is to be able to control a few different lights in my home from my iPhone, eventually locks, blinds, etc.. The iPhone side is all setup, I am just worried about spending money on the x10 stuff, and it all being wrong.

Thanks.
2  Using Arduino / Programming Questions / Re: Ethernet & SD - SD working once. on: October 03, 2012, 09:36:42 am
Brilliant thanks for the help, and for explaining it.
3  Using Arduino / Programming Questions / Re: Ethernet & SD - SD working once. on: October 02, 2012, 02:11:05 pm
Thanks for the quick reply.

No actual error message, what I meant was the "Card Failed, or not present."

Edit:

After moving the if statement to setup() it is working fine on refresh, could you explain to me why?
4  Using Arduino / Programming Questions / Ethernet & SD - SD working once. on: October 02, 2012, 02:01:28 pm
Hello,

I am pretty new to Arduino, I am trying to set up a simple web server reading its contents from an sd card.

The first time I connect through a browser everything works as expected, the sd file is printed and the client disconnects. The second time I try to load the page, the SD fails to read the file, however the page loads returning the error message.

Below is my code, I would appreciate it if somebody could point out what the problem is.

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <SD.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 };
IPAddress ip(192,168,2,177);

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

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
  }

  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
 
  pinMode(10, OUTPUT);
}


void loop() {
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");

    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {           
        char c = client.read();

        if (c == '\n' && currentLineIsBlank) {

          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>");
 
          if (!SD.begin(4)) {
            Serial.println("Card failed, or not present");
            client.println("Card Fail");
          } else {
             
            File dataFile = SD.open("Wake.txt");

            if (dataFile) {
              while (dataFile.available()) {
                client.write(dataFile.read());
              }
            dataFile.close();
            }
             
          }
         
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          currentLineIsBlank = false;
        }
      }
    }
    delay(1);
    client.stop();
    Serial.println("client disonnected");
  }
}

I am using an Arduino Uno with the Ethernet Shield and a 1GB Mico SD card.
Pages: [1]