mjbogusz / wiringPi

Up-to-date WiringPi library with Odroid boards support and CMake building.
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Outputs does not work on a Raspberry Pi #3

Open romainreignier opened 7 years ago

romainreignier commented 7 years ago

Hi,

Because I was using your vl53l0x-linux driver, I had to use your fork of Wiring Pi in order to get the bulk transfer on i2c. So I tried to use the XSHUT pin on the sensor and other GPIOs. For the inputs, it was OK, I managed to use them successfully. But I did not manage to toggle a single pin set as output. Even changing the mode was not possible. I did not understand the issue, that is why I post it here.

Note that the GPIO are working because I have switched to the library pigpio and everything worked as expected.

Thanks

mjbogusz commented 7 years ago

If I understand correctly, you've tried to do pinMode(pin, OUTPUT); , is this correct?

Just making sure, but have you called wiringPiSetup() or wiringPiSetupGpio() before that? Also make sure which GPIO numbering you're using, BCM's or WiringPi's.

This can surely be a bug somewhere in my code introduced e.g. in the upstream version that I've merged (it was the newest one at the time but not anymore) or somewhere during the merge process. Additionally I don't own a Pi currently so it's hard to test, not to mention adding Odroid boards support was a bit hackish so it might have broken something even if it shouldn't have.

As a sidenote, if you're using WiringPi only because of that VL53L0X driver, try the i2cdev version. It drops the WiringPi dependency so you can freely use any other library (or even the mainstream WiringPi).

romainreignier commented 7 years ago

Yes, I have tried a pinMode(pin, OUTPUT) then a digitalWrite(pin, HIGH) and the GPIO remains in mode INPUT and the state does not change.

And yes I have tried with both wiringPiSetup() and wiringPiSetupGpio() and double checking the correct numbering in each case. Note the in INPUT mode, it works, even to set the Pull-Up.

Note that it does not work to blink a single LED and within the VL53L0X driver to switch ON/OFF the XSHUT pin.

mjbogusz commented 6 years ago

I've added a note to README about this library being broken.

In the meantime, I'm updating vl53l0x-linux so that it doesn't use WiringPi anymore.