Friday, 15 December 2017

Blink LED Raspbery pi3 (P1)


Welcome to MAC+tech We will Start Programming with raspberry pi..
before the start, we show pin diagram, a previous post we detail about raspberry pi types and various port  Read hare..

Pin Digram :

Image result for raspberry pi 3 pin dig

IMP Pins Means All Are IMP But Most of time use full pins...
_______________________VCC AND GND_________________
pin 1     -3.3v
pin 2,4  -5v
pin 6,9,14,20,25,30,34,39 - GND
---------------------------------------------------------------------------------
________________________CLOCK PIN____________________

pin 7 - GPIO4 (GPIO_GCLK)
----------------------------------------------------------------------------------

---------------------------------------------------------------------------------
Start Raspberry Pi Note :
 1. Bootable Memory card Insert Before Power supply attach .
 2. Not Remove memory card After power on
 3. use standard 5-volt power 
_____________________________________________________

Reured resourcess:
Raspberry pi    :)
LED 
1K register (if avilable) <- optional

Circuit Diagram / Connection :

LED +ve connect to Pin 12 (means Second colum 6 no) ie GPIO 18 
LED -ve Any GND

Program for Blink LED :


######################################

Auther    :  Kishor M Sonawane

#Company:  MAC+tech

#Program  : Blink LED Using Key Bord press 1 to on LED 0 to off LED


import RPi.GPIO as GPIOimport timeGPIO.setmode(GPIO.BCM)

GPIO.setwarnings(False)

GPIO.setup(18,GPIO.OUT)while True:    

kk=input('1 or 0')   

if kk==1:        

    print('LED on')        

    GPIO.output(18,GPIO.HIGH)    

else:

    print('LED off')

    GPIO.output(18,GPIO.LOW)

#######################################


Process /RUN Steps :
Copy Code Save Raspberry Pi Any Directory 
as led.py or any_name.py
 open Terminal (Ctrl+Alt+t) goto Directory Where Program Store.

type n terminal :

$ python led.py
LED on
0
LED off


use Ctrl+c to exit program
*NOTE : we Use Python So indentation very proper single space may be problematic ..


Thank You  

-Kishor M Sonawane




create and activate a Python virtual environment on macOS and Windows

create and activate a Python virtual environment on macOS and Windows: Prerequisites: Python 3: Ensure you have Python 3 installed. You ca...