chi00933
Posts: 15
Joined: Thu Mar 03, 2016 12:23 pm

wiringPi question

Thu Mar 03, 2016 1:42 pm

I did test output of raspberryPi by using LED. So, I tried to add wiringPi libararies. But, I don't know what prefix is on the process to make CROSS GCC. So, I operated eclipse with Linux GCC and first, I added wiringPi.h. But, when I tried to add the liabrary, I could not find wiring.so. Instead, I did find libwiringPi.so. So, I added it. As the result, I succeeded compile but, even though I followed the instruction of a book, LEDs wasn't turned on. What is the problem?

User avatar
gordon@drogon.net
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: wiringPi question

Thu Mar 03, 2016 2:26 pm

chi00933 wrote:I did test output of raspberryPi by using LED. So, I tried to add wiringPi libararies. But, I don't know what prefix is on the process to make CROSS GCC. So, I operated eclipse with Linux GCC and first, I added wiringPi.h. But, when I tried to add the liabrary, I could not find wiring.so. Instead, I did find libwiringPi.so. So, I added it. As the result, I succeeded compile but, even though I followed the instruction of a book, LEDs wasn't turned on. What is the problem?
Hard to tell - probably you're using the wrong pin numbering scheme.

What pin is your LED connected to?

Did you test is using the gpio program before writing any code?

-Gordon
--
Gordons projects: https://projects.drogon.net/

chi00933
Posts: 15
Joined: Thu Mar 03, 2016 12:23 pm

Re: wiringPi question

Sun Mar 06, 2016 4:09 am

Thank you for your reply. I am a korean in master degree in korea. I am supposed to connet F/T sensor and gripper with raspberryPi by using CAN 2.0(F/T sensor) and RS-485(gripper). But, because I am in first step, I don't have the least idea of it. I mean...I don't know how to start to make program about CAN 2.0b and RS-485, even though I read manual so as to know protocols. I should use eclipse with C/C++. Can you give me a program source about CAN 2.0b and RS-485. I know I should use MCP2515 and MCP2551 and I will use a board including them. Thank you.( I need also annotation)

Goraxium
Posts: 122
Joined: Tue Jan 26, 2016 1:42 pm

Re: wiringPi question

Sun Mar 06, 2016 3:43 pm

It sounds like homework... If it is, you need to do it yourself. No point in having a degree if you don't know how things work (would you trust an engineer to build the home you live in, if you knew they got other people to do their assignments for them?).

Regarding the first post, run the command 'gpio readall' to find the pin you're trying to use, as referenced here:
http://wiringpi.com/the-gpio-utility/

Since the MCP2515 CAN device uses SPI, you can find out how to set that up here:
http://wiringpi.com/reference/spi-library/

The RS485 might be a different issue (voltage issues, from what I've read), but you should be able to use a USB to RS485 adapter for that (or an I2C board).

Keep in mind that the Pi uses 3.3V logic, not 5V. If you use 5V, you will kill the Pi. You can get adapter boards that switch up to 5V and back down to 3.3V, relatively cheap.

[EDIT]
Also, make sure you have a resistor in the LED circuit, otherwise you will kill the LED.

Return to “C/C++”