Meg2560 Inputs and outputs

Hey guys I want to build a larger input output module to relay via mqtt to home assistant.

i was looking at doing this with a pi but it turns out the mega has a lot more inputs and outputs. Please be gentle as I am just going down this road but here are my questions:

  1. If I use an ethernet shield do I reduce the number of inputs / outputs?

  2. Can I use analog inputs (eg reed switches) as an input end point?

Thanks in advance!

Neil

An Ethernet shield merely deprives you of using the five pins it uses for other purposes. This is not normally a problem with a Mega.

Your other question is unintelligible. I would not expect a reed switch to be an analogue device. Just in case you are not aware of it, the Mega's analogue pins may also be used as digital.

A reed switch that is a physical switch isn't considered analog? I would imagine an analog input would measure a momentary button press? Is that correct?

Thanks for the clarification on the ethernet shield. It sounds like it wouldn't reduce the number of inputs at all.

Thanks!

Neil

Digital pins read on and off, a switch

Analog pins read variable values, 0 through 1023, from 0 to +5 VDC

Analog pins are also digital pins

heffneil:
A reed switch that is a physical switch isn't considered analog? I would imagine an analog input would measure a momentary button press? Is that correct?

Analog inputs are used to measure a variable voltage, like from a potentiometer or many sensors.

Digital inputs are used for things that are either HIGH/LOW or ON/OFF i.e. have only two positions of interest. Reed switches, buttons and most other switches fall into this input type.

Steve

Wow I had that completely backward! See I learned something - Thanks!

Well, there you go - and you probably ended up with more pins than you thought.

Yeah I wasn't thinking "digital is 1 or 0) I was thinking it was more precise with voltage levels and whatnot.

Thats why I was backwards like a float was digit and analog would be on or off. I was thinking about it completely wrong.

I am assuming analog could be set to use a pull up resistor for a digital style input?

Thanks!

Neil

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.