Skip to content

Instantly share code, notes, and snippets.

@adi928
Created March 21, 2019 19:33
Show Gist options
  • Save adi928/3a1be57231abd57c2ab57e152f193f0d to your computer and use it in GitHub Desktop.
Save adi928/3a1be57231abd57c2ab57e152f193f0d to your computer and use it in GitHub Desktop.
pocket_hypnotizer.c
#include <stdio.h> // Used for printf() statements
#include <wiringPi.h> // Include WiringPi library!
// Pin number declarations. We're using the Broadcom chip pin numbers.
const int ledPin1 = 18; // PWM LED - Broadcom pin 18, P1 pin 12
const int ledPin2 = 23; // Regular LED - Broadcom pin 23, P1 pin 16
const int ledPin3 = 24;
const int ledPin4 = 25;
const int pwmValue = 1024; // Use this to set an LED brightness
int main(void)
{
wiringPiSetupGpio(); // Initialize wiringPi -- using Broadcom pin numbers
pinMode(ledPin1, OUTPUT); // Set regular LED as output
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
printf("Blinker is running! Press CTRL+C to quit.\n");
while (1)
{
digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(ledPin1, LOW);
delay(100);
digitalWrite(ledPin2, HIGH);
delay(100);
digitalWrite(ledPin2, LOW);
delay(100);
digitalWrite(ledPin3, HIGH);
delay(100);
digitalWrite(ledPin3, LOW);
delay(100);
digitalWrite(ledPin4, HIGH);
delay(100);
digitalWrite(ledPin4, LOW);
delay(100);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment