rockleee
Posts: 6
Joined: Thu Sep 27, 2018 10:08 am

can not use wiringPi with code blocks

Thu Sep 27, 2018 2:35 pm

hello i am trying to close a light through a code that i write.
first off all i run this commands in the terminal
"gpio -g mode 17 output"
"gpio -g write 17 0"
and i added a LED light and i can see it work even when i close the terminal
and then i wrote this code and for some reason it dosen't close the LED
can someone pls help me?
Attachments
2018-09-27-172352_1184x624_scrot.png
2018-09-27-172352_1184x624_scrot.png (112.53 KiB) Viewed 355 times

User avatar
buja
Posts: 474
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

Re: can not use wiringPi with code blocks

Thu Sep 27, 2018 7:05 pm

In the terminal commands you switch the LED on and off, but in your program you only switch it on.
So all you need to do is add an instruction to switch the LED off, just like you do on the command line.

ElEscalador
Posts: 619
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: can not use wiringPi with code blocks

Thu Sep 27, 2018 10:25 pm

Been a while but I think I get this error every time I newly install code::blocks on a new pi - I always forget to go to linker settings. With your project open, go to Setting -> Compiler -> Linker Settings (middle tab). Then in the left pane under "Link Libraries" click "add" then find your library. Mine (and yours should be) /usr/lib/libwiringPi.so

I don't know why but sometimes I have to do this a few times with each new install before it sticks and I never have to do it again.
My Autonomous Robot Project and a few of my other projects below.

https://lloydbrombach.wordpress.com/

rockleee
Posts: 6
Joined: Thu Sep 27, 2018 10:08 am

Re: can not use wiringPi with code blocks

Sun Sep 30, 2018 7:25 am

ElEscalador wrote:
Thu Sep 27, 2018 10:25 pm
Been a while but I think I get this error every time I newly install code::blocks on a new pi - I always forget to go to linker settings. With your project open, go to Setting -> Compiler -> Linker Settings (middle tab). Then in the left pane under "Link Libraries" click "add" then find your library. Mine (and yours should be) /usr/lib/libwiringPi.so

I don't know why but sometimes I have to do this a few times with each new install before it sticks and I never have to do it again.
thanks !

Return to “C/C++”