Show Posts
Pages: [1] 2
1  Using Arduino / Networking, Protocols, and Devices / Re: How can make sd work while ethernet working? on: March 09, 2013, 09:30:17 am
Thank you, done.
2  Using Arduino / Networking, Protocols, and Devices / Re: How can make sd work while ethernet working? on: March 09, 2013, 08:56:32 am
I am not talking about your code, ok I am trying with char array.
3  Using Arduino / Networking, Protocols, and Devices / Re: How can make sd work while ethernet working? on: March 09, 2013, 08:44:44 am
Code:
while (myFile.available()) {
            s += (char)myFile.read();
       
              }

I mean commenting out this part. Not to trying to read anything in the sd.
4  Using Arduino / Networking, Protocols, and Devices / Re: How can make sd work while ethernet working? on: March 09, 2013, 08:28:49 am
Nope, it's not working. When I commented out the sd read related parts it works
5  Using Arduino / Networking, Protocols, and Devices / Re: How can make sd work while ethernet working? on: March 09, 2013, 07:26:46 am
Actually I tried almost every combination with, pin 4 and 10, low and high. Still can't get it through.
6  Using Arduino / Networking, Protocols, and Devices / Re: How can make sd work while ethernet working? on: March 09, 2013, 06:45:20 am
1.0.1 on MacBook
7  Using Arduino / Networking, Protocols, and Devices / Re: How can make sd work while ethernet working? on: March 09, 2013, 06:41:18 am
Thank you for your warning.

Zintinger, are you suggesting something like:
Code:
void setup(){
  for(int i = 0;i<48;i++)
    state[i] = false;
  Serial.begin(9600);
  uint8_t mac[]     = { 0x90, 0xA2, 0xDA, 0x00, 0x51, 0x06 };
  uint8_t ip[]      = { 192, 168, 1, 7 };
  uint8_t gateway[] = { 192, 168, 1, 255 };
  uint8_t subnet[]  = { 255, 255, 255, 0 };
 

 
  pinMode(4,OUTPUT);
  pinMode(10,OUTPUT);
  digitalWrite(4,LOW);
  digitalWrite(10,HIGH);
 
 
 
  if(!SD.begin(4));
    return;
 
  digitalWrite(10,LOW);
  digitalWrite(4,HIGH);
  Ethernet.begin(mac, ip,gateway,gateway,subnet);
 
  delay(2000);
  server2.begin();
 
 

}
this?
8  Using Arduino / Networking, Protocols, and Devices / Re: How can make sd work while ethernet working? on: March 09, 2013, 06:33:37 am
SurferTime, there are just one line of string in the files. Without ethernet connection I can read them very well. Also this format 
Code:
Ethernet.begin(mac, ip,gateway,subnet);
is working, I tested and used it other places.
9  Using Arduino / Networking, Protocols, and Devices / How can make sd work while ethernet working? on: March 09, 2013, 05:49:59 am
I need to implement a xml server, which takes some information from SD card, actually contents of 48 files. I understand that I need to switch between sd and Ethernet and I tried every suggestion I could find in here, but I still can accomplish it. Could you please make me a suggestion?(By the way I'm using an Arduino Ethernet Board)

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


File myFile;
boolean state[48];
char ch[3];

EthernetServer server2(80);

void setup(){
  for(int i = 0;i<48;i++)
    state[i] = false;
  Serial.begin(9600);
  uint8_t mac[]     = { 0x90, 0xA2, 0xDA, 0x00, 0x51, 0x06 };
  uint8_t ip[]      = { 192, 168, 1, 7 };
  uint8_t gateway[] = { 192, 168, 1, 255 };
  uint8_t subnet[]  = { 255, 255, 255, 0 };
 

 

  pinMode(10,OUTPUT);
  digitalWrite(10,HIGH);
 
 
 
  if(!SD.begin(4));
    return;
 
 
  Ethernet.begin(mac, ip,gateway,subnet);
  digitalWrite(10,HIGH);
  delay(2000);
  server2.begin();
 
}

void loop(){
 
  EthernetClient client2 = server2.available();
  if(client2){
 
    boolean currentLineIsBlank = true;
    while (client2.connected()) {
      if (client2.available()) {
        char c = client2.read();
       
        if (c == '\n' && currentLineIsBlank) {
          client2.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Devices>");
          for(int i = 0; i<48; i++){
            String(i).toCharArray(ch,3);
            myFile = SD.open(ch);
            if (myFile) {
            client2.print("<Device id=\"");
            client2.print(ch);
            client2.print("\">");
            client2.print("<name>");
           
            String s = " ";
           
              //Serial.println(ch);
              // read from the file until there's nothing else in it:
              while (myFile.available()) {
            s += (char)myFile.read();
       
              }
              client2.print(s);
              client2.print("</name>");
              client2.print("<state>");
              client2.print(state[i]);
              client2.print("</state>");
              client2.println("</Device>");
              myFile.close();
              s = " ";
              //delay(10);
              } else {
        // if the file didn't open, print an error:
                Serial.println("error opening file");
              }
            }
          client2.println("</Devices>");
          //client2.println("<br />");
          //client2.println("</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:
    client2.stop();
    //Serial.println("client disonnected");
  }
 

}
10  Using Arduino / Networking, Protocols, and Devices / Re: Arduino + Android on: March 05, 2013, 01:20:07 pm
I was going to connect an arduino to my unrooted tablet for a project and I did some research on how to do it.
I didn't try it, you may use serial rxtx java in your application to interface information came from arduino and sent to arduino.
But, in order to do that your tablet should recognize the arduino and when I try to list device with lsusb command in terminal
emulator it can't find the board. It's possible to there is no implementation of lsusb on terminal emulator.
Either way it's hard to connect an arduino to android device, even if it's possible other ways much easier.

People generally do it with connecting a shield to the arduino.
You can use a bluesmirf and use amarino (bluetoth Connection)
You can use a  wifi or ethernet shield and pass information through network.
Or you can use just host shield and adk to do the job.

You may use Android I/O but in that case, it does not work with every device(It worked with
a couple of phones, but didn't work with my tablet).
11  Using Arduino / General Electronics / Re: Is there any way to make Multiplexer shield output conditionally constant on: March 05, 2013, 12:43:39 pm
Thank you DanDare.

It will help definitely, but I solved it with programming and connecting 3 8051 micro-controllers. I know they are a little outdated but does the job.

Again thank you   
12  Using Arduino / Networking, Protocols, and Devices / Re: Is it possible to create multiple servers on Arduino Ethernet on: February 27, 2013, 12:34:17 pm
Thank you
13  Using Arduino / Networking, Protocols, and Devices / Re: Is it possible to create multiple servers on Arduino Ethernet on: February 27, 2013, 10:17:11 am
It's not necessary, I'm just a little bit a lazy for reverse engineering of others software
14  Using Arduino / General Electronics / Re: Is there any way to make Multiplexer shield output conditionally constant on: February 27, 2013, 10:14:18 am
I checked the shift registers concept and couple of data sheets. It's probably wouldn't work. I need to directly address which outlet I want to turn on and off.
15  Using Arduino / General Electronics / Is there any way to make Multiplexer shield output conditionally constant on: February 27, 2013, 09:30:22 am
Hello,
I am kind of newbie in arduino development and has a limited knowledge on electronic circuits.
I'm using an arduino uno and a multiplexer shield to multiply its output.However, as you may know multiplexer shield
losses the state when another port is selected. Is there any way to change the situation other then programing other microcontroller?
For example, a relay or flip flop like a thing, that when I gave a signal to the multiplexer shields any port first time it goes high and
second time I gave a signal to the same port it turns low?
Pages: [1] 2