Hello.
I'm use the sabj. I need the RS-232<->Ethernet converter.
My code is summary examples Ethernet Telnet & SoftwareSerial:
/*
The circuit:
* RX is digital pin 3 (connect to TX of other device)
* TX is digital pin 5 (connect to RX of other device)
*/
#include <SoftwareSerial.h>
#include <SPI.h>
#include <Ethernet.h>
SoftwareSerial mySerial(3, 5); // RX, TX
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 1, 177);
IPAddress myDns(192,168,1, 1);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 0, 0);
// telnet to port 509
EthernetServer server(509);
boolean alreadyConnected = false; // whether or not the client was connected previously
void setup() {
// initialize the ethernet device
Ethernet.begin(mac, ip, myDns, gateway, subnet);
// start listening for clients
server.begin();
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Chat server address:");
Serial.println(Ethernet.localIP());
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop() {
// wait for a new client:
EthernetClient client = server.available();
// when the client sends the first byte, say hello:
//if (client) {
// if (!alreadyConnected) {
// clear out the input buffer:
// client.flush();
// Serial.println("We have a new client");
// client.println("Hello, client!");
// alreadyConnected = true;
// }
if (client.available() > 0) {
// read the bytes incoming from the client:
byte thisChar = client.read();
//char thisChar = client.read();
// echo the bytes back to the client:
server.write(thisChar);
// echo the bytes to the server as well:
Serial.write(thisChar);
mySerial.write(thisChar);
//mySerial.println(thisChar);
//}
}
if (mySerial.available()) {
byte serChar = mySerial.read();
Serial.write(serChar);
server.write(serChar);
//}
}
}
But in com-port(3,5 pins) i have a bad symbols. Help me please. I want to get the same symbols that I send to the port ethernet. Port monitoring in IDE show me good symbols.
It's pretty stupid to use the name of a type in the name of a variable, when the type used in the name is not the type of the variable. DO NOT DO THAT!
What is connected to pins 3 and 5? Please post a picture of your mySerial.
I use Arduino Uno and shield W5100. My English is so bad?
Not on the Arduino.
But why? exchange only 4 packages per minute.
byte thisChar = client.read();
It's pretty stupid to use the name of a type in the name of a variable, when the type used in the name is not the type of the variable. DO NOT DO THAT!
I agree. but this example was supplied with IDE. I did not change.
What is connected to pins 3 and 5? Please post a picture of your mySerial.
In example use pins 10&11, but that pins use in connected with Ethernet shield. I took 3 and 5 pins because near them drawn ~ as near 10 and 11 pins.
I guess it is. I still have no idea what "I'm use the sabj." means.
But why? exchange only 4 packages per minute.
That has NOTHING to do with needing, or not needing, an RS232 to TTL converter ON THE ARDUINO. If you meant something else, POST A LINK TO THE HARDWARE!
I agree. but this example was supplied with IDE.
Which example? I'll post a complaint in the appropriate section if this is indeed true.
I took 3 and 5 pins because near them drawn ~ as near 10 and 11 pins.
The original sketch used 10 and 11 because they are next to each other, not because they are PWM pins. And I still no not know what is connected to those pins. What I do know is that whatever the physical device is, it is NOT a mySerial, so that instance name is stupid.
PaulS:
That has NOTHING to do with needing, or not needing, an RS232 to TTL converter ON THE ARDUINO. If you meant something else, POST A LINK TO THE HARDWARE!
you think that I need a converter 232 <-> TTL? for example MAX232? inversion and a decrease in voltage? i'm stupid!!! I was looking for a bug in the code but the problem in the hardware. Thank you!
Sorry, but I think the language barrier is creating misunderstandings here. Please give us a diagram of your system so we can understand how things are connected.