Results for “serial”
Small, practical examples. Search by task or narrow things down below.
Explain a sketch with comments
Arduino / C: Use single-line and block comments to document what a sketch does.
Arduino / C✓ Tested
Extract a section of an Arduino String
Arduino / C: substring includes the start index and excludes the end index.
Arduino / C✓ Tested
Extract the low and high byte of a value
Arduino / C: lowByte and highByte expose the two bytes of a 16-bit value.
Arduino / C✓ Tested
Find a division remainder
Arduino / C: Find a division remainder on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested
Find a sample range in one pass
Arduino / C: Initialize extrema from the first element of a nonempty array.
Arduino / C✓ Tested
Find a value in a small lookup table
Arduino / C: A linear scan is simple and predictable for a small fixed array.
Arduino / C✓ Tested
Format several integers in a fixed buffer
Arduino / C: snprintf limits writes to the buffer size and includes a terminating null byte.
Arduino / C✓ Tested
Generate and measure a short output pulse
Arduino / C: delayMicroseconds can create a short blocking pulse on an output pin.
Arduino / C✓ Tested
Give an LED pin a constant name
Arduino / C: Use const to name the built-in LED pin and reuse it in output instructions.
Arduino / C✓ Tested
Group related readings in a struct
Arduino / C: A struct keeps a sample’s fields together without dynamic allocation.
Arduino / C✓ Tested
Hello World: Blink
Arduino / C: Blink the built-in LED slowly and then quickly, repeating both rates in loop().
Arduino / C✓ Tested
Ignore small movements around a center value
Arduino / C: Values inside the deadband become zero while others keep their direction.
Arduino / C✓ Tested