Как правильно подключить 25 входов и 19 выходов?

etaon
Offline
Зарегистрирован: 16.12.2011

Уважаемые знатоки, подскажите пожалуйста :)

Arduino MEGA 2560.

Есть у нас 25 управляющих кнопок.

Кнопки подключены по схеме через резистор 1кОм. В ней же есть светодиод для тестовой индикации.

Подается на все кнопки +5В с БП. Ну и т.д.

Есть 19 реле управляемых. 3 платы по 8 релюшек.

Часть реле работает при минимальной нагрузке, а часть крутит моторчики для шторок, форточек в офисе.

 

Всё планирую подключить на цифровые входы\выходы. Дабы не мутить с кодом при подаче команды для разных портов.

Какие порты в arduino лучше не задействовать, дабы не было ложных срабатываний при перезагрузке или тестировании работы по com порту.

D0 дергается вроде бы

D13 помигивает светодиодом

D14-D21 коммуникационные. Они живут своей жизнью?

Быть может, когда-то дойдем до того ,что Bluetooth на com порт зацепим и софт напишем :)

etaon
Offline
Зарегистрирован: 16.12.2011

Pins of the Arduino


This page is far from complete at this time, but I wanted to get one (or two) candles lit for you, at least.

This page is more "Wikipedia" in nature than the more "tutorial" nature of most of my pages.

 

This page will be most useful to readers who are already a bit of familiar with the Arduino, or a clone.


The basic digital pins....

A simple Arduino has digital I/O pins 0-13. Of these, several are "special"...

----------------

D0 and D1 are used in the serial interface between your Arduino and the PC you are using to program the Arduino. The same channel is used by the system's very useful serial monitor. (If you aren't using that yet, try to learn how!)

Unless you are very short of digital I/O for your needs, it is probably best to leave D0 and D1 out of your plans, so that what you are doing with them and what the system is doing with them don't clash.

----------------

D10-D13 are used to create the SPI bus. You may not know what that is now, but someday you will learn to love it. If you are using a "fancy" shield, for instance one to give your Arduino access to an SD memory card, you are probably using the SPI bus.

If you are using the SPI bus, it is probably best to avoid using D10- D13 for other things at the same time. There are situations of shared use which are okay... but if you don't already know that, you aren't ready to start doing it!

D13 is "special" in another way: In many cases, on the Arduino's PCB, there will be an LED connected to D13 and thence, through an appropriate resistor, to ground. Not only then, is D13 "compromised" by this "extra" hardware, but you should also be aware of the following little "gotcha": As the system boots up, D13 will be made an output. (All the other i/o lines come out of a reset as inputs.) And the system software, before it executes whatever you've put in setup();, will briefly take D13 high before returning it to low.

----------------

A0-A5, the analog pins: If you don't happen to need them as analog pins, you can use them as digital pins! Just refer to them as pins 14 to 19, or as "A0" to "A5". Thus, the following would work, although I would recommend that you use "14" throughout, and eschew the "A0" option....

   pinMode(A0,OUTPUT);
   digitalWrite(14,HIGH):

(That would make the "Analog0" pin a digital output, and set it high.)

etaon
Offline
Зарегистрирован: 16.12.2011

SPI не задействуем.

D13 ну и пусть дергается. Поставим его на выход. Есть места, где несущественно подергивание релюшкой. Если она успеет дернуться.

А когда com порт включим и тестить будем, D0-D1 будут дрегаться?