Skip to main content

Posts

Featured

Raspberry PI 3+ python blinking LED

I've recently been getting into the raspberry PI world. I have a model 3+ that one of my first projects was to get an LED to blink. The following below will make an LED blink for a random amount of time for a random amount of times. import RPi.GPIO as GPIO import time import random from random import * # set the output mode of the GPIO pins GPIO.setmode(GPIO.BCM) # don't show warnings in the console GPIO.setwarnings(False) # this sets the output to pin 18 (positive) GPIO.setup(18,GPIO.OUT) # we randomly pick some numbers numberOfBlinks = randint(10,30) blinkLength = randint(1,5) print(numberOfBlinks,blinkLength) print("LEDs on") counter = 0 # loop through and turn the LED on and off while counter <= numberOfBlinks: # set the output to high (ON) GPIO.output(18,GPIO.HIGH) # wait for X seconds time.sleep(blinkLength) # set the output to low (OFF) GPIO.output(18,GPIO.LOW) counter =…

Latest Posts

WPF create a grid splitter

WPF Bind a combobox to an enumeration

C# async and await

C# Updated on Threading with .net 4

C# parse invalid XML characters

using jqGrid in an MVC View

jqGrid get data from MVC Controller

Kendo UI grid update row using Javascript/jQuery

ASP.net MVC dynamically create and return image from Controller

ASP.net MVC Ajax.BeginForm with busy icon