Latest Python on PI | Luciano's tech see the web in desktop mode to better experience | 474 OS | 309 OS Pi 4B | 88 OS Pi5
We Program Raspberry Pi with C:
Actualización gracias a Agusthina Oliva
Para programar nuestros proyectos con C en Raspberry Pi tenemos 2 opciones--We have 2 options:
BCM2835
Wiring Pi
BCM2835: Pin 11 GPIO 17
Wiring Pi: Pin 11 WPi Pin 0
En ambos es el Pin fisico 11
In both is the physical Pin 11
Utilizar este Fork --- Newest WiringPi Fork works in Pi400:
git clone https://github.com/WiringPi/WiringPi.git
cd WiringPi
./build
sudo reboot
Podemos confirmar con--We can check with:
gpio readall
Eso es todo saltemos a la parte de--That's all jump to Geany part.
Abrimos el Terminal y tecleamos lo siguiente--Open Terminal and choose the latest version by typing:
Método antiguo--Old method
cd
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.67.tar.gz
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.73.tar.gz
Documentación--Docs:
Descomprimimos la versión descargada--Untar:
tar zxvf bcm2835-*.tar.gz
rm bcm28*tar.gz
Nos situamos en el nuevo directorio--Go to the new directory:
cd bcm2835*
Ejecutamos configure--Type:
./configure
Ejecutamos make--Type:
make
Ejecutamos con permisos root make check--Check with sudo:
sudo make check
Ejecutamos con permiso root la instalación--Install:
sudo make install
Debemos enlazar la librería bcm2835 a nuestros comandos, yendo a la opción Construir-> Establecer comando de construcción:
We need link the library wiringPi to our build commands, go to Build -->Set Build Commands:
Compile: gcc -Wall -c "%f" -lbcm2835
Build: gcc -Wall -o "%e" "%f" -lbcm2835
gcc -o miprograma miprograma.c -lbcm2835
./miprograma
/home/pi/bcm2835-1.67/examples
o
~/bcm2835-1.71/examples
gpio -v
Antes no venia instalado en Raspbian Stretch y veíamos esto.--On Raspbian we see these on the past, because not came with the OS.
Hoy en dia con Raspberry Pi OS ya viene pre-instalado.--Now came pre-installed but not in his latest version
sudo apt-get purge -y wiringpi
hash -r
sudo apt-get purge -y wiringpi
hash -r
cd
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
rm wiring*.deb
Podemos observar la última versión instalada.--We can see the lates version installed
Verificamos con gpio -v la nueva--Check the difference vesion with gpio -v
gpio readall
gpio readall de una--on a Raspberry Pi 3B
gpio readall de una--on a Raspberry pi 4B
Debemos enlazar la librería wiringPi a nuestros comandos, yendo a la opción Construir --> Establecer comandos de construcción:
We need link the library wiringPi to our build commands, go to Build -->Set Build Commands:
Compile: gcc -Wall -c "%f" -lwiringPi
Build: gcc -Wall -o "%e" "%f" -lwiringPi
gcc -o miprograma miprograma.c -lwiringPi
./miprograma