Do you have any idea of what's the reason if the pins of the board are changing after everytime that i use digitalwrite?
Do you have any idea of what's the reason if the pins of the board are changing after everytime that i use digitalwrite?
Which pins? Changing how? When?
Post your code. Post a schematic.
This board has default pins. 13 is the led, 3 relay1 and 6 relay2. The problem is that from the start of the program every pin is different from the standard and if i find the pins and use them, after one instruction they change ...
I can't use sample codes too:
int Relay = 3;
void setup()
{
pinMode(13, OUTPUT); //Set Pin13 as output
digitalWrite(13, HIGH); //Set Pin13 High
pinMode(Relay, OUTPUT); //Set Pin3 as output
}
void loop()
{
digitalWrite(Relay, HIGH); //Turn off relay
delay(2000);
digitalWrite(Relay, LOW); //Turn on relay
delay(2000);
}
Change this
int Relay = 3;
to
const byte Relay = 3;
That should keep it from changing.
The variable isn't changing, it's the pin of the element idk how
The problem is that from the start of the program every pin is different from the standard
I really have no idea what this means. What "standard" are you referring to? How are the pins different? How are you determining that?
This is the documentation X-Board_Relay_SKU_DFR0222_-DFRobot
By trying with a for i determined that and then i tried by activating via input to be sure of that
By trying with a for i determined that and then i tried by activating via input to be sure of that
I don't know if google translate was involved, but that is hard to understand.
I'm assuming that "by trying with a for" means that you have some code that you used to set the state of some, or all, of the pins. If that is a valid assumption, you should post that code, and your observations.
If you set all the relay pins as OUTPUT, and set them all HIGH, and something happened on some pins but not on others, we need to know what happened, on which pins.
"and then i tried by activating via input to be sure of that".
Again, I'm going to assume that you have some code that accepts input, from somewhere, and does something with that input to change the state of one or more of the relay pins. You need to post that code, and describe what input you supplied, and what your observations were. What did the pin do, or not do?
Sorry, i tought that you could understand. Anyway now the board isn't changing pins anymore, so the first problem is solved.
The only one issue that i'm still trying to fight, is the connection fail with 0 state when i try to connect via ethernet.
I used n to cover numbers of server.
Code:
#include <SPI.h>
#include <Ethernet.h>
byte port = nnnnn;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
IPAddress server(nnn,nnn,n,nnn);
EthernetClient client;
void setup() {
Ethernet.begin(mac, ip);
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");
int ethWorked = client.connect(server, port);
if (ethWorked == 1) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println(ethWorked);
Serial.println("connection failed");
}
}
Output:
connecting...
0
connection failed
disconnecting.
byte port = nnnnn;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
It seems strange to redact your port number, when you publish your IP address. Not that your IP address means anything, since it is a local address, and we have no idea what it is local to.
Is your server actually listening to, and accepting connections on, the port you specified?
That is, can you connect to it using a browser with the same IP address and port number?
To say the truth, i tought that "ip" cointained the new ip for the board ...
Anyway the server is listening, that's why i can't understand why it isn't working.
I tried to start the ethernet connection without "Ip" but it stucks if i do that, but i wanted a dhcp connection, so i'm a little bit confused about it
To say the truth, i tought that "ip" cointained the new ip for the board ...
It does. Most times, people redact that, and leave the port visible.
So, using a browser, with http://nnn,nnn,n,nnn:nnnnn in the address bar results in a connection being made? What is returned? (Assuming that you put the correct data in place of the redacted values, of course).
You don't really expect to have the GET command work, do you?
So what should i do for a dhcp connection? If i put only the mac on the begin line, the code stucks.
You were true, i'm not working on a personal server, i'm working via remote connection on this board, for a server of my boss. I tried the public ip : the port that he told me they opened for external connections and effectively, i can't talk with it.. what should i do? I try to see if the firewall is blocking connections
No, i know the GET string is just a copy of an example, i just leaved it there couse i was fighting another problem.
Edit:
Ethernet Chip: Wiz5100
I tried again with the dhcp ethernet connection and sometimes it worked, but now it's failing again after some resets.
Could it be a problem of the shield?