Skip to main content
5 votes
Accepted

Digital I/O threshold voltages for ATmega32u4

LVTTL is Low Voltage Transistor-Transistor Logic. In general, the term "TTL" is used for a digital signal. The "Low Voltage" part is special, the ATmega32U4 switches from low to high (and vice versa) ...
Jot's user avatar
  • 3,286
5 votes
Accepted

How to set sampling rate for digital pin input?

You need: A timer A board that is capable of running fast enough to do what you want. The Nano fits the first criteria, but not the second. At 16MHz you get a clock period of 63ns. That means you ...
Majenko's user avatar
  • 106k
4 votes

USB reset fails on arduino due because of 5v on digital pins

You're over-stressing the MCU and causing all sorts of horrible things to happen with the power rails. Of course nasty things are going to happen. The only way to fix it is to change the circuitry. ...
Majenko's user avatar
  • 106k
4 votes
Accepted

Digital Pins reads 1 when configured with internal_pullup

There is no difference between a switch and a "pin" for input. All are either HIGH or LOW. You tie it HIGH with the pullup, and then try giving it a HIGH with +5V (Caution: The Due is a 3.3V device, ...
Majenko's user avatar
  • 106k
3 votes
Accepted

How much voltage and current can a Arduino uno digital input sink?

One common misconceptions is that the current limit of a GPIO pin applies to inputs. It does not. The 40mA "maximum sink" is only applicable when the pin is set to OUTPUT and is driven LOW - at ...
Majenko's user avatar
  • 106k
3 votes

Cannot read LED state

A digital input on the Arduino Uno is guaranteed to read LOW if the input voltage is less than 1.5 V. It is guaranteed to read HIGH if that voltage is above 3.0 V. For any voltage in between, you have ...
Edgar Bonet's user avatar
  • 45.2k
3 votes

How to set sampling rate for digital pin input?

Note: this is an attempt to answer the question as asked. This answer is unlikely to be of any use to the original poster, who presumably asked the wrong question. I am writing this only as a way to ...
Edgar Bonet's user avatar
  • 45.2k
3 votes
Accepted

Fast digital IO

You can do this with an Uno, provided it has nothing else to do. I would program it low-level, skipping the Arduino core since, as you said, digitalWrite() would be too slow for this application. Here ...
Edgar Bonet's user avatar
  • 45.2k
2 votes
Accepted

Cannot read LED state

For the CMOS logic the treshold is usually 1/2 Vcc, therefore you might get lucky with arduino 3.3V Arduinos, but it's still in undefined area. That usual threshold can also change with operating ...
KIIV's user avatar
  • 4,907
2 votes

Reading multiple DI pins in parallel as one byte/word

I'm sure time has already passed for this persons project. But for those visiting this page for whatever reason (mine was different than the information here) here is a solution I would implement. ...
Jason's user avatar
  • 21
2 votes
Accepted

Additional Digital Input Pins

You could use a GPIO expander (MCP23017 or similar) which could give you 14 extra pins (16-2 for I2C bus), but this is putting extra load on the microprocessor. (you haven't said which one by the way)...
Code Gorilla's user avatar
  • 5,652
2 votes
Accepted

Mixing analog reads with raw port reads

What you are trying to do is perfectly safe. In fact, you reading PINC will have no effect whatsoever on the input circuitry. You are just reading an I/O register and, whether you read it or not, this ...
Edgar Bonet's user avatar
  • 45.2k
2 votes
Accepted

Read Digital Input from Arduino Pin defined as OUTPUT

If you want to know the state of the load, I suggest to put the mechanical switch on the low-voltage side of the relay: simulate this circuit – Schematic created using CircuitLab The voltage ...
Edgar Bonet's user avatar
  • 45.2k
2 votes

arduino mega buzzer output

Any time you have the same sequence of code repeated over and over with slight variations, that is a "code smell" (an indication that you may be using the wrong approach.) You should use ...
Duncan C's user avatar
  • 5,752
1 vote

How long does my digital pulse need to be for it to be read?

As explained by Majenko's answer, you should detect the pulses from an interrupt and print the result from the regular code. However, instead of just setting a flag in the interrupt handler, I suggest ...
Edgar Bonet's user avatar
  • 45.2k
1 vote

How long does my digital pulse need to be for it to be read?

This is exactly the reason interrupts were invented. They can respond a lot faster than a simple digital read. By "a lot" I mean orders of magnitude. When an interrupt is triggered your interrupt ...
Majenko's user avatar
  • 106k
1 vote

How can I scan for a HIGH signal on digitalRead during the main loop, while running other things?

Simplify, and show your setup code. First, do you have a pinMode call in your setup function: void setup() { pinMode(A15, INPUT_PULLUP); Serial.begin(115200); } Then use test code like this: ...
Duncan C's user avatar
  • 5,752
1 vote
Accepted

Using NodeMCU D8 (GPIO15), D4 (GPIO2) and D3 (GPIO0) pins

The boot setup pins have pull-up on board (0, 2) and pull-down (15) to ensure the correct boot. io 0 (D3) is additionally wired to the reset circuit controlled over USB to put the esp8266 into ...
Juraj's user avatar
  • 18.3k
1 vote

How to monitor state of 50 Digital Inputs

I had a project that used 16 rotary encoders and I used the MUX Shield which uses 74HC4067 analog multiplexers. They port to A0 - A3 on the shield which is fine as you can set these pins to Digital ...
Brian Moreau's user avatar
1 vote

Mixing analog reads with raw port reads

In general, most embedded processors multiplex external pins into specialized internal circuits. Circuits which check standard fixed threshold crossings (digital inputs), circuits which check ...
st2000's user avatar
  • 7,513
1 vote
Accepted

Reading input from digital pins 36, 37, 38 in Arduino Mega 2560 is giving a problem

I expect the problem is in the circuit. To be sure, put a serial print statement directly after reading the inputs, to be sure the input values are read correctly. See the remark of using INPUT or ...
Michel Keijzers's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible