uno + w5100
- Войдите на сайт для отправки комментариев
Втр, 14/06/2016 - 14:35
Добрый день.
Взял Uno R3. Залил код:
01 | /* |
02 | Software serial multple serial test |
03 |
04 | Receives from the hardware serial, sends to software serial. |
05 | Receives from software serial, sends to hardware serial. |
06 |
07 | The circuit: |
08 | * RX is digital pin 10 (connect to TX of other device) |
09 | * TX is digital pin 11 (connect to RX of other device) |
10 |
11 | Note: |
12 | Not all pins on the Mega and Mega 2560 support change interrupts, |
13 | so only the following can be used for RX: |
14 | 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69 |
15 |
16 | Not all pins on the Leonardo support change interrupts, |
17 | so only the following can be used for RX: |
18 | 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI). |
19 |
20 | created back in the mists of time |
21 | modified 25 May 2012 |
22 | by Tom Igoe |
23 | based on Mikal Hart's example |
24 |
25 | This example code is in the public domain. |
26 |
27 | */ |
28 | #include <SoftwareSerial.h> |
29 |
30 | SoftwareSerial mySerial(3, 5); // RX, TX |
31 |
32 | void setup () { |
33 | // Open serial communications and wait for port to open: |
34 | Serial .begin(9600); |
35 | while (! Serial ) { |
36 | ; // wait for serial port to connect. Needed for native USB port only |
37 | } |
38 |
39 |
40 | Serial .println( "Goodnight moon!" ); |
41 |
42 | // set the data rate for the SoftwareSerial port |
43 | mySerial.begin(9600); |
44 | mySerial.println( "Hello, world?" ); |
45 | } |
46 |
47 | void loop () { // run over and over |
48 | if (mySerial.available()) { |
49 | Serial .write(mySerial.read()); |
50 | } |
51 | if ( Serial .available()) { |
52 | mySerial.write( Serial .read()); |
53 | } |
54 | } |
По сути код из примеров с небольшими изменениями. Все работает, байты из одного порта в другой бегают и обратно тоже. Втыкиваю сверху шилд w5100, точно также втыкаю проводочки от com-port в GND, 3 и 5 - все :( никто никуда не бегает. Если в ардуинку залить код например telnet из примеров, то работает.
Мне, по сути, надо преобразователь интерфейсов RS-232<->Ethernet.
Если все перезагрузить, то работает. Странно.