Skip to content

Instantly share code, notes, and snippets.

View theokelo's full-sized avatar

Onyango Okelo theokelo

View GitHub Profile
int ledPin = 9;
int potPin = A2; // select the input pin for the potentiometer
int val = 0; // variable to store the value coming from the sensor
int seed = 92;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
@theokelo
theokelo / led4_7_595MSB.ino
Created April 21, 2018 13:13
Arduino Code for a Controlling a Common Cathode 4 Digit 7 Segment Display using Two Shift Registers
int latchPin = 2; //pin 12 on the 595
int dataPin = 3; //pin 14 on the 595
int clockPin = 4; //pin 11 on the 595
//D1 = 256, D2 = 512, D3 = 1024, D4 = 2048
int D1 = 3584;
int D2 = 3328;
int D3 = 2816;
int D4 = 1792;
// assigning arduino digital pins for the various led display pins
int pinA = 3;
int pinB = 7;
int pinC = 12;
int pinD = 10;
int pinE = 9;
int pinF = 4;
int pinG = 13;
int pinDP = 11; // the decimal point pin
int D1 = 2;
@theokelo
theokelo / pushAndFade.ino
Created August 3, 2015 09:04
Arduino Code for an LED button control
int LED = 9; //pin for the LED
int BUTTON = 7; //pin for the BUTTON
int val = 0; //stores state of the pin
int old_val = 0; //stores previous state of the pin
int state = 0;
int brightness = 128; //stores brightness value
int old_b = 127;
unsigned long startTime = 0; //when did we begin pressing?
void setup()
@theokelo
theokelo / helloWorld.c
Created June 8, 2015 16:39
Introductory C Program
#include <stdio.h>
int main (void)
{
printf("Hello world!");
return 0;
}
@theokelo
theokelo / blinkingLED.ino
Last active January 10, 2018 04:49
Arduino Blinking LED Code
// Example 01 : Blinking LED
const int LED = 13; // LED connected to digital pin 13
void setup ()
{
pinMode(LED, OUTPUT); //sets the digital pin as output