Connection to pins GND yellow wire 5th pin from left to right
and GPIO17 green wire 6th from left to right
Circuit with led and a resistor (~330 Ohms)
To use Python nothing have to be installed
#!/usr/bin/pythonfrom gpiozero import LEDfrom time import sleepled = LED(17)for num in range(1,10):led.on()sleep(1)led.off()
sleep(1)
# git clone git://git.drogon.net/wiringPi
# cd wiringPi
#./build
Pin 0 is the GPIO17
blink.c
blink.c
#include <wiringPi.h>
#define LED 0
int main (void)
{
int i ;
wiringPiSetup() ;
pinMode (LED, OUTPUT) ;
for (i=0 ; i < 10; i++)
{
digitalWrite(LED, HIGH) ;
delay(500) ;
digitalWrite(LED, LOW) ;
delay(500) ;
}
return 0 ;
}
# gcc -L/usr/local/lib -lwiringPi -lwiringPiDev -lpthread -lm -I/usr/local/include -Winline -pipe -o blink blink.c
# export WIRINGPI_GPIOMEM=1
# ./blink
WIRINGPI_GPIOMEM variable is to use the /dev/gpiomem instead of /dev/mem. Without this variable set you need root privilegies to execute the program
http://wiringpi.com
https://www.raspberrypi.org/learning/python-quick-reaction-game/worksheet
Pins for reference, in this example we use the pin G017 and Ground(GND)
# export WIRINGPI_GPIOMEM=1
# ./blink
WIRINGPI_GPIOMEM variable is to use the /dev/gpiomem instead of /dev/mem. Without this variable set you need root privilegies to execute the program
http://wiringpi.com
https://www.raspberrypi.org/learning/python-quick-reaction-game/worksheet
Pins for reference, in this example we use the pin G017 and Ground(GND)



No comments:
Post a Comment