Results for “digit”
Small, practical examples. Search by task or narrow things down below.
Read an unpressed button with an internal pull-up
Arduino / C: An open input configured with INPUT_PULLUP reads high.
Arduino / C✓ Tested
Stop receiving interrupts when a task finishes
Arduino / C: detachInterrupt removes the registered callback.
Arduino / C✓ Tested
Toggle an output using an explicit software state
Arduino / C: Keep the intended output state in a Boolean variable.
Arduino / C✓ Tested
Turn on the built-in LED
Configure the Uno’s LED pin as an output and drive it high.
LED_BUILTIN✓ Tested
Blink the built-in LED three times
Alternate the built-in LED with a short blocking delay.
blink✓ Tested
Control an LED from a button
Translate an active-low button input into an LED output.
button✓ Tested
Count a falling edge with an interrupt
Increment a counter when an external input changes.
attachInterrupt✓ Tested
Encode a byte buffer as hexadecimal
C: Format each byte as an unsigned two-digit hexadecimal value.
C✓ Tested
Extract numbers from text
Find all runs of ASCII digits in a string and convert the matches to integers.
regex✓ Tested
Format a decimal number
Format a Java decimal with two digits and a fixed locale.
Java✓ Tested
Format a decimal value
Print two fractional digits with C printf.
C✓ Tested
Format a nonnegative integer amount as whole and fractional units
C: Keep the calculation in integer minor units and use two digits for the remainder.
C✓ Tested