hawkmoon
Posts: 2
Joined: Sat Sep 29, 2012 2:41 pm

help programing

Sat Sep 29, 2012 3:30 pm

assembled my gertboard last saturday in 3hrs everything seams to be working
got new sd card loaded new wheezy RPi.GPIO-0.4.1a python-dev python3-dev and geany
sd card booted up went to element 14 and downloaded 38-101479 made a folder in /home/pi called gertboard and unziped the gertboard_sw into it i typed cd gertboard/gertboard_sw enter and then make all so far so good type ls and all the c files are there so how do i get them to run
i open lx terminal type buttons.c and get bash: buttons.c: command not found tryed it from in gertboard/gertboard_sw same answer tryed sudo ./buttons.c same answer
if i open buttons.c in geany and run it it starts asks me to check wireing and press enter then says i may have to run in root
i am pulling my hair out it is a week now and still cant get it to run anything can anyone help :(

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2810
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: help programing

Sat Sep 29, 2012 5:52 pm

easy fix

just put a

sudo ./ in front of the command.

e.g. if you are in the gertboard_sw directory and you want to run motor, type

Code: Select all

sudo ./motor
If you're anywhere else, the full path to the program will work (as it should in the gertboard_sw directory too)

You do need to run as root though, so the sudo is necessary
Alex Eames RasPi.TV, RasP.iO

hawkmoon
Posts: 2
Joined: Sat Sep 29, 2012 2:41 pm

Re: help programing

Sat Sep 29, 2012 6:22 pm

many thanks dropped .c and works fine knew it had to be simple mistake whole week wasted thanks again

User avatar
Gert van Loo
Posts: 2474
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: help programing

Sat Sep 29, 2012 7:49 pm

Yes, the .c is the source file. You need the executable.
To see if a file is executable type "ls -l".
It lists each file, the data and the size but most important in this case are the 'permission' flags.
They look like -rw-rw-rw-
'r' means you have permission to read the file.
'w' means you have permission to write the file.
'x' means you have permission to execute (run) the file.
The same holds for directories and you need to have 'x' permission to go into a directory.
There are three sets of rwx, one for all users, one for the group and the last one for the owner.

More details here: http://www.gnu.org/software/coreutils/m ... ation.html

djwilly
Posts: 2
Joined: Fri Oct 03, 2014 11:27 pm

Re: help programing

Fri Oct 03, 2014 11:57 pm

Hello,
all the progamms e.g. buttons, leds..... are runnung on my Raspi B+ and my Gertboard, but how can I compile my own c- programm with the macros INP_GPIO, OUT_GIPO........ in Geany?
I would be happy for a Tipp.

User avatar
Gert van Loo
Posts: 2474
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: help programing

Sat Oct 04, 2014 8:34 am

djwilly wrote:Hello,
all the progamms e.g. buttons, leds..... are runnung on my Raspi B+ and my Gertboard, but how can I compile my own c- programm with the macros INP_GPIO, OUT_GIPO........ in Geany?
I would be happy for a Tipp.
I am afraid that I can't teach you to program remotely.
But luckily, in this case plagiary, stealing, copying, it is all allowed.
So look through the source code, see what it does.
You should see the same pattern over and over when the code operates the controls.
Then adjust that pattern to what you want it to do.

djwilly
Posts: 2
Joined: Fri Oct 03, 2014 11:27 pm

Re: help programing

Sun Oct 05, 2014 8:35 pm

Thank you Gert,
now I know what was wrong:
in Geany I had to change the settings for Build (in German: Erstellen) in the Set build commands (in German: Kommandos zum Erstellen konfigurieren) to
cc "%" gb_common.c -o "%e"
Now all my Programms with the Gertboard works in Geany.
Greets
Willy

Return to “Add-ons”

Who is online

Users browsing this forum: martinrowan and 6 guests