FastLED 3.9.15
Loading...
Searching...
No Matches

◆ verifyJumperWire()

bool verifyJumperWire ( int pin_tx,
int pin_rx )

Verify jumper wire connection between TX and RX pins.

Tests that a physical jumper wire correctly connects the TX and RX pins by setting TX HIGH/LOW and verifying RX reads the same values.

Parameters
pin_txTX pin number (output pin)
pin_rxRX pin number (input pin)
Returns
true if jumper wire is working correctly, false otherwise

Definition at line 7 of file test.cpp.

7 {
8 FL_WARN("Verifying jumper wire connection between GPIO " << pin_tx << " and GPIO " << pin_rx << "...");
9
10 pinMode(pin_tx, OUTPUT);
11 pinMode(pin_rx, INPUT);
12
13 // Test HIGH
14 digitalWrite(pin_tx, HIGH);
15 delay(1); // Allow signal to propagate
16 int rx_high = digitalRead(pin_rx);
17
18 // Test LOW
19 digitalWrite(pin_tx, LOW);
20 delay(1); // Allow signal to propagate
21 int rx_low = digitalRead(pin_rx);
22
23 if (rx_high != HIGH || rx_low != LOW) {
24 FL_ERROR("Jumper wire sanity check FAILED!");
25 FL_ERROR(" digitalWrite(TX=" << pin_tx << ", HIGH) → digitalRead(RX=" << pin_rx << ") = " << rx_high << " (expected HIGH=1)");
26 FL_ERROR(" digitalWrite(TX=" << pin_tx << ", LOW) → digitalRead(RX=" << pin_rx << ") = " << rx_low << " (expected LOW=0)");
27 FL_ERROR("");
28 FL_ERROR("REQUIRED: Physically connect GPIO " << pin_tx << " to GPIO " << pin_rx << " with a jumper wire!");
29 return false;
30 }
31
32 FL_WARN("✓ Jumper wire verified: GPIO " << pin_tx << " → GPIO " << pin_rx << " signal path working");
33 return true;
34}
#define FL_WARN(X)
Definition log.h:276
#define FL_ERROR(X)
Definition log.h:219
void delay(u32 ms, bool run_async=true) FL_NOEXCEPT
Public delay wrapper that keeps bare Arduino delay() preferred after using fl::delay; while still all...
Definition delay.h:98
void pinMode(int pin, PinMode mode)
Set pin mode (input, output, pull-up, pull-down)
Definition pin.cpp.hpp:378
PinValue digitalRead(int pin)
Read digital value from pin.
Definition pin.cpp.hpp:55
void digitalWrite(int pin, PinValue val)
Write digital value to pin.
Definition pin.cpp.hpp:51

References FL_ERROR, and FL_WARN.

Referenced by setup().

+ Here is the caller graph for this function: