0

I'm writing in C++ using WiringPi to integrate with GPIO but it doesn't seem to work during runtime.

Below I have a simple example of an output wired to an input expecting the input to read HIGH, but it is not outputting anything. I've tried running in the terminal gpio -g mode 24 out and neither the Mode or V voltage values change when running gpio readall.

wiringPiSetup();
pinMode(24, OUTPUT);
pinMode(25, INPUT);

while(true) 
{
digitalWrite(24, HIGH);
delay(500);
RCLCPP_INFO(get_logger(), "25: %d", digitalRead(25)); // ROS 2 cout equivalent 
}

I've also tried configuring input reading from the 3.3V output and still reading 0. I used a voltmeter to confirm it wasn't a hardware issue.

Why is it not working? Any insight on how to fix/debug this?

Resources

5
  • Which OS??? Perhaps you didn't read enough?
    – Seamus
    Nov 27, 2023 at 23:14
  • Wiring Pi will not work on a Raspberry Pi 5. It's a wonder it still works anywhere, it's been unsupported since 2019. Change to any other GPIO library, like gpiod.
    – Dougie
    Nov 27, 2023 at 23:15
  • OS: Ubuntu 22.04 Model: Raspberry Pi 4
    – Yato
    Nov 28, 2023 at 16:36
  • I actually got the gpio terminal commands working and it reflected correctly in the gpio readall. Using the library in a C++ file is not working still.
    – Yato
    Nov 28, 2023 at 19:45
  • I was following Setup and API and nothing on the second link worked for me.
    – Yato
    Nov 28, 2023 at 19:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.