Skip to content

Instantly share code, notes, and snippets.

@littlekbt
Created October 19, 2016 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save littlekbt/3c20f9cad8ad9c8e4ae4f84a886f6e29 to your computer and use it in GitHub Desktop.
Save littlekbt/3c20f9cad8ad9c8e4ae4f84a886f6e29 to your computer and use it in GitHub Desktop.
# command
# pi, gpio, wiringPi mapping confirm
# $ gpio readall
# use wiringPi pin number
# $ gpio mode [pin no] out
# $ gpio write [pin no] 1
# $ gpio write [pin no] 0
# use pi pin number
# $ gpio mode -1 [pin no] out
# $ gpio write -1 [pin no] 1
# $ gpio write -1 [pin no] 0
# use gpio -g pin number
# $ gpio mode -g [pin no] out
# $ gpio write -g [pin no] 1
# $ gpio write -g [pin no] out
# https://tool-lab.com/make/raspberrypi-startup-24/
####################################################
# program
#include "./wiringPi/wiringPi.h"
#include <stdio.h>
#define WRITE_PIN 8
void main()
{
if(wiringPiSetup() == -1){
printf("error wiringPi setup\n");
return;
}
pinMode(WRITE_PIN, OUTPUT);
while(1) {
digitalWrite(WRITE_PIN, 0); //LED off
delay(1000); //wait 1000ms
digitalWrite(WRITE_PIN, 1); //LED on
delay(1000); //wait 1000ms
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment