SlideShare a Scribd company logo
Introduction to PythonIntroduction to Python
ProgrammingProgramming
Why Python?Why Python?
 Python is what is referred to as an object-oriented programming
language (OOP)
 Python is a general purpose programming language. That means you
can use Python to write code for a number of programming tasks.
◦ Google search engine
◦ Gaming
◦ Processing financial
transactions
◦ Data Analytics
◦ Physical Programming
 Simple
 Less Syntax
 Extensive User Community
 Interpreted
Interpreted?Interpreted?
Python is interpreted, which means that
python code is translated and executed by
an interpreter one statement at a time.
This means you can run commands/code
on the command prompt…
Through a command
prompt with a text file…
Using an IDE
What Does It Look Like?What Does It Look Like?
Parts of a Python ProgramParts of a Python Program
Def: Source Code is the program text
entered into an interpreter by the
programmer.
◦ The saved file is referred to as, the source file.
◦ The main file in a python program, called main
◦ Can program on the command prompt
The extension to a python source file is “.py”
◦ Xcel - .xls
◦ Power Point - .ppt
Two main parts to a source file
◦ Modules
◦ Main code
Good Programming ProclamationsGood Programming Proclamations
Using comments to denote programs or
sections of code
◦ A comment beginning with # is called a single-line comment
because it terminates at the end of the current line.
◦ You also may use a multi-line comment—possibly containing
many lines—begins with ’’’ and ends with ’’’.
You use blank lines, space characters and tab characters
(i.e., “tabs”) to make programs easier to read.
◦ Together, these characters are known as white space.
◦ White-space characters are USUALLY ignored by the interpreter.
◦ Python has its own rules with white space
ModulesModules
 A module is a python source file that has prewritten
python code.
 These predefined files allow users to utilize code that has
been previously developed.
◦ Don’t have to recreate the wheel, just use the wheel and
improve on the technology.
 math
 time
 gpiozero
 os
 Code: Importing modules
 import module_name
 from module_name import class_name
ExpressionsExpressions
• A programming expression is a
combination of symbols to represent a
value.
• One side of an equation
• Ex.
• 5+7
• False
• print()
• led.on()
Printing a Line of TextPrinting a Line of Text
print(“ “)
Anything placed inside the quotes will be printed on the screen
upon execution of the print command.
Manipulating TimeManipulating Time
The time module is a popular module which
provides functions for working with times and
converting between them.
◦ sleep
◦ local time
◦ epoch time
Code:
◦ Importing time module
 import time
◦ Using time functions
 time.sleep(#)
 time.localtime(time.time())
Manipulating LED’sManipulating LED’s
 The Raspberry Pi comes with a library RPi.GPIO that allow
the manipulation of GPIO pins:
◦ Setup pins as inputs or outputs
◦ Read inputs, Set output levels
◦ Cleanup
 Code:
◦ Importing gpio module
 import RPi.GPIO as GPIO
 GPIO.setmode(GPIO.BCM)
◦ Setup an LED
 GPIO.setup(pin#, GPIO.OUT)
◦ Using led functions
 GPIO.output(pin#,GPIO.HIGH)
 GPIO.output(pin#,GPIO.LOW)
CheckpointCheckpoint
1. What is an IDE?
2. What is a comment and its importance?
3. How is white space used in
programming?
4. What are modules?
5. Name 2 modules

More Related Content

What's hot

Introduction to python programming, Why Python?, Applications of Python
Introduction to python programming, Why Python?, Applications of PythonIntroduction to python programming, Why Python?, Applications of Python
Introduction to python programming, Why Python?, Applications of Python
Pro Guide
 
Python presentation by Monu Sharma
Python presentation by Monu SharmaPython presentation by Monu Sharma
Python presentation by Monu Sharma
Mayank Sharma
 
Python | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python TutorialPython | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python Tutorial
QA TrainingHub
 
Python
PythonPython
Python programming introduction
Python programming introductionPython programming introduction
Python programming introduction
Siddique Ibrahim
 
Python course syllabus
Python course syllabusPython course syllabus
Python course syllabus
Sugantha T
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1Kanchilug
 
Benefits & features of python |Advantages & disadvantages of python
Benefits & features of python |Advantages & disadvantages of pythonBenefits & features of python |Advantages & disadvantages of python
Benefits & features of python |Advantages & disadvantages of python
paradisetechsoftsolutions
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An Introduction
Swarit Wadhe
 
20120314 changa-python-workshop
20120314 changa-python-workshop20120314 changa-python-workshop
20120314 changa-python-workshop
amptiny
 
Python programming
Python programmingPython programming
Python programming
Megha V
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programmingKiran Vadakkath
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
Akhil Kaushik
 
Python programming
Python programmingPython programming
Python programming
Prof. Dr. K. Adisesha
 
Python 101
Python 101Python 101
Python 101
Ahmet SEĞMEN
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
AnirudhaGaikwad4
 
Presentation on java
Presentation on javaPresentation on java
Presentation on java
william john
 
Introduction to python
 Introduction to python Introduction to python
Introduction to python
Learnbay Datascience
 
Introduction about Python by JanBask Training
Introduction about Python by JanBask TrainingIntroduction about Python by JanBask Training
Introduction about Python by JanBask Training
JanBask Training
 

What's hot (20)

Introduction to python programming, Why Python?, Applications of Python
Introduction to python programming, Why Python?, Applications of PythonIntroduction to python programming, Why Python?, Applications of Python
Introduction to python programming, Why Python?, Applications of Python
 
Python presentation by Monu Sharma
Python presentation by Monu SharmaPython presentation by Monu Sharma
Python presentation by Monu Sharma
 
Python | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python TutorialPython | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python Tutorial
 
Python
PythonPython
Python
 
Python programming introduction
Python programming introductionPython programming introduction
Python programming introduction
 
Python course syllabus
Python course syllabusPython course syllabus
Python course syllabus
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
 
Benefits & features of python |Advantages & disadvantages of python
Benefits & features of python |Advantages & disadvantages of pythonBenefits & features of python |Advantages & disadvantages of python
Benefits & features of python |Advantages & disadvantages of python
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An Introduction
 
20120314 changa-python-workshop
20120314 changa-python-workshop20120314 changa-python-workshop
20120314 changa-python-workshop
 
Python programming
Python programmingPython programming
Python programming
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
Python Tutorial Part 2
Python Tutorial Part 2Python Tutorial Part 2
Python Tutorial Part 2
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
Python programming
Python programmingPython programming
Python programming
 
Python 101
Python 101Python 101
Python 101
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Presentation on java
Presentation on javaPresentation on java
Presentation on java
 
Introduction to python
 Introduction to python Introduction to python
Introduction to python
 
Introduction about Python by JanBask Training
Introduction about Python by JanBask TrainingIntroduction about Python by JanBask Training
Introduction about Python by JanBask Training
 

Similar to Intro to Python with GPIO

Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
TIB Academy
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
Sujith Kumar
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdf
VaibhavKumarSinghkal
 
Introduction python
Introduction pythonIntroduction python
Introduction python
Jumbo Techno e_Learning
 
intro.pptx (1).pdf
intro.pptx (1).pdfintro.pptx (1).pdf
intro.pptx (1).pdf
ANIKULSAIKH
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
anaveenkumar4
 
ppt notes for python language variable data types
ppt notes for python language variable data typesppt notes for python language variable data types
ppt notes for python language variable data types
SukhpreetSingh519414
 
Python Programming Draft PPT.pptx
Python Programming Draft PPT.pptxPython Programming Draft PPT.pptx
Python Programming Draft PPT.pptx
LakshmiNarayanaReddy48
 
INTRODUCTION-TO-PYTHON
INTRODUCTION-TO-PYTHONINTRODUCTION-TO-PYTHON
INTRODUCTION-TO-PYTHON
RuchiNagar3
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
lemonchoos
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
gabriellekuruvilla
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
michaelaaron25322
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming Language
R.h. Himel
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installing
Mohd Sajjad
 
637b4894085c4_ppt.pptx
637b4894085c4_ppt.pptx637b4894085c4_ppt.pptx
637b4894085c4_ppt.pptx
Arjun123Bagri
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
KPDDRAVIDIAN
 
Python Programming
Python ProgrammingPython Programming
Python Programming
RenieMathews
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
HaythamBarakeh1
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
MohammadSamiuddin10
 

Similar to Intro to Python with GPIO (20)

Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdf
 
Introduction python
Introduction pythonIntroduction python
Introduction python
 
intro.pptx (1).pdf
intro.pptx (1).pdfintro.pptx (1).pdf
intro.pptx (1).pdf
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
 
ppt notes for python language variable data types
ppt notes for python language variable data typesppt notes for python language variable data types
ppt notes for python language variable data types
 
Python Programming Draft PPT.pptx
Python Programming Draft PPT.pptxPython Programming Draft PPT.pptx
Python Programming Draft PPT.pptx
 
INTRODUCTION-TO-PYTHON
INTRODUCTION-TO-PYTHONINTRODUCTION-TO-PYTHON
INTRODUCTION-TO-PYTHON
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming Language
 
Python-00 | Introduction and installing
Python-00 | Introduction and installingPython-00 | Introduction and installing
Python-00 | Introduction and installing
 
637b4894085c4_ppt.pptx
637b4894085c4_ppt.pptx637b4894085c4_ppt.pptx
637b4894085c4_ppt.pptx
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
Python Programming
Python ProgrammingPython Programming
Python Programming
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 

More from primeteacher32

Software Development Life Cycle
Software Development Life CycleSoftware Development Life Cycle
Software Development Life Cycle
primeteacher32
 
Variable Scope
Variable ScopeVariable Scope
Variable Scope
primeteacher32
 
Returning Data
Returning DataReturning Data
Returning Data
primeteacher32
 
Intro to Functions
Intro to FunctionsIntro to Functions
Intro to Functions
primeteacher32
 
Introduction to GUIs with guizero
Introduction to GUIs with guizeroIntroduction to GUIs with guizero
Introduction to GUIs with guizero
primeteacher32
 
Function Parameters
Function ParametersFunction Parameters
Function Parameters
primeteacher32
 
Nested Loops
Nested LoopsNested Loops
Nested Loops
primeteacher32
 
Conditional Loops
Conditional LoopsConditional Loops
Conditional Loops
primeteacher32
 
Introduction to Repetition Structures
Introduction to Repetition StructuresIntroduction to Repetition Structures
Introduction to Repetition Structures
primeteacher32
 
Input Validation
Input ValidationInput Validation
Input Validation
primeteacher32
 
Windows File Systems
Windows File SystemsWindows File Systems
Windows File Systems
primeteacher32
 
Nesting Conditionals
Nesting ConditionalsNesting Conditionals
Nesting Conditionals
primeteacher32
 
Conditionals
ConditionalsConditionals
Conditionals
primeteacher32
 
Variables and Statements
Variables and StatementsVariables and Statements
Variables and Statements
primeteacher32
 
Variables and User Input
Variables and User InputVariables and User Input
Variables and User Input
primeteacher32
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pi
primeteacher32
 
Hardware vs. Software Presentations
Hardware vs. Software PresentationsHardware vs. Software Presentations
Hardware vs. Software Presentations
primeteacher32
 
Block chain security
Block chain securityBlock chain security
Block chain security
primeteacher32
 
Hashes
HashesHashes
System Administration
System AdministrationSystem Administration
System Administration
primeteacher32
 

More from primeteacher32 (20)

Software Development Life Cycle
Software Development Life CycleSoftware Development Life Cycle
Software Development Life Cycle
 
Variable Scope
Variable ScopeVariable Scope
Variable Scope
 
Returning Data
Returning DataReturning Data
Returning Data
 
Intro to Functions
Intro to FunctionsIntro to Functions
Intro to Functions
 
Introduction to GUIs with guizero
Introduction to GUIs with guizeroIntroduction to GUIs with guizero
Introduction to GUIs with guizero
 
Function Parameters
Function ParametersFunction Parameters
Function Parameters
 
Nested Loops
Nested LoopsNested Loops
Nested Loops
 
Conditional Loops
Conditional LoopsConditional Loops
Conditional Loops
 
Introduction to Repetition Structures
Introduction to Repetition StructuresIntroduction to Repetition Structures
Introduction to Repetition Structures
 
Input Validation
Input ValidationInput Validation
Input Validation
 
Windows File Systems
Windows File SystemsWindows File Systems
Windows File Systems
 
Nesting Conditionals
Nesting ConditionalsNesting Conditionals
Nesting Conditionals
 
Conditionals
ConditionalsConditionals
Conditionals
 
Variables and Statements
Variables and StatementsVariables and Statements
Variables and Statements
 
Variables and User Input
Variables and User InputVariables and User Input
Variables and User Input
 
Raspberry Pi
Raspberry PiRaspberry Pi
Raspberry Pi
 
Hardware vs. Software Presentations
Hardware vs. Software PresentationsHardware vs. Software Presentations
Hardware vs. Software Presentations
 
Block chain security
Block chain securityBlock chain security
Block chain security
 
Hashes
HashesHashes
Hashes
 
System Administration
System AdministrationSystem Administration
System Administration
 

Recently uploaded

Chapters 3 Contracts.pptx Chapters 3 Contracts.pptx
Chapters 3  Contracts.pptx Chapters 3  Contracts.pptxChapters 3  Contracts.pptx Chapters 3  Contracts.pptx
Chapters 3 Contracts.pptx Chapters 3 Contracts.pptx
Sheldon Byron
 
Heidi Livengood Resume Senior Technical Recruiter / HR Generalist
Heidi Livengood Resume Senior Technical Recruiter / HR GeneralistHeidi Livengood Resume Senior Technical Recruiter / HR Generalist
Heidi Livengood Resume Senior Technical Recruiter / HR Generalist
HeidiLivengood
 
New Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdfNew Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdf
Dr. Mary Askew
 
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
foismail170
 
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdfDOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
Pushpendra Kumar
 
How to Master LinkedIn for Career and Business
How to Master LinkedIn for Career and BusinessHow to Master LinkedIn for Career and Business
How to Master LinkedIn for Career and Business
ideatoipo
 
Brand Identity For A Sportscaster Project and Portfolio I
Brand Identity For A Sportscaster Project and Portfolio IBrand Identity For A Sportscaster Project and Portfolio I
Brand Identity For A Sportscaster Project and Portfolio I
thomasaolson2000
 
一比一原版(YU毕业证)约克大学毕业证如何办理
一比一原版(YU毕业证)约克大学毕业证如何办理一比一原版(YU毕业证)约克大学毕业证如何办理
一比一原版(YU毕业证)约克大学毕业证如何办理
yuhofha
 
太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
foismail170
 
134. Reviewer Certificate in Computer Science
134. Reviewer Certificate in Computer Science134. Reviewer Certificate in Computer Science
134. Reviewer Certificate in Computer Science
Manu Mitra
 
Midterm Contract Law and Adminstration.pptx
Midterm Contract Law and Adminstration.pptxMidterm Contract Law and Adminstration.pptx
Midterm Contract Law and Adminstration.pptx
Sheldon Byron
 
Luke Royak's Personal Brand Exploration!
Luke Royak's Personal Brand Exploration!Luke Royak's Personal Brand Exploration!
Luke Royak's Personal Brand Exploration!
LukeRoyak
 
han han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi samahan han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi sama
IrlanMalik
 
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
Dirk Spencer Corporate Recruiter LION
 
一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
yuhofha
 
The Impact of Artificial Intelligence on Modern Society.pdf
The Impact of Artificial Intelligence on Modern Society.pdfThe Impact of Artificial Intelligence on Modern Society.pdf
The Impact of Artificial Intelligence on Modern Society.pdf
ssuser3e63fc
 
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
larisashrestha558
 
Digital Marketing Training In Bangalore
Digital  Marketing Training In BangaloreDigital  Marketing Training In Bangalore
Digital Marketing Training In Bangalore
nidm599
 
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
atwvhyhm
 
Personal Brand Exploration Comedy Jxnelle.
Personal Brand Exploration Comedy Jxnelle.Personal Brand Exploration Comedy Jxnelle.
Personal Brand Exploration Comedy Jxnelle.
alexthomas971
 

Recently uploaded (20)

Chapters 3 Contracts.pptx Chapters 3 Contracts.pptx
Chapters 3  Contracts.pptx Chapters 3  Contracts.pptxChapters 3  Contracts.pptx Chapters 3  Contracts.pptx
Chapters 3 Contracts.pptx Chapters 3 Contracts.pptx
 
Heidi Livengood Resume Senior Technical Recruiter / HR Generalist
Heidi Livengood Resume Senior Technical Recruiter / HR GeneralistHeidi Livengood Resume Senior Technical Recruiter / HR Generalist
Heidi Livengood Resume Senior Technical Recruiter / HR Generalist
 
New Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdfNew Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdf
 
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
 
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdfDOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
DOC-20240602-WA0001..pdf DOC-20240602-WA0001..pdf
 
How to Master LinkedIn for Career and Business
How to Master LinkedIn for Career and BusinessHow to Master LinkedIn for Career and Business
How to Master LinkedIn for Career and Business
 
Brand Identity For A Sportscaster Project and Portfolio I
Brand Identity For A Sportscaster Project and Portfolio IBrand Identity For A Sportscaster Project and Portfolio I
Brand Identity For A Sportscaster Project and Portfolio I
 
一比一原版(YU毕业证)约克大学毕业证如何办理
一比一原版(YU毕业证)约克大学毕业证如何办理一比一原版(YU毕业证)约克大学毕业证如何办理
一比一原版(YU毕业证)约克大学毕业证如何办理
 
太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
太阳城娱乐-太阳城娱乐推荐-太阳城娱乐官方网站| 立即访问【ac123.net】
 
134. Reviewer Certificate in Computer Science
134. Reviewer Certificate in Computer Science134. Reviewer Certificate in Computer Science
134. Reviewer Certificate in Computer Science
 
Midterm Contract Law and Adminstration.pptx
Midterm Contract Law and Adminstration.pptxMidterm Contract Law and Adminstration.pptx
Midterm Contract Law and Adminstration.pptx
 
Luke Royak's Personal Brand Exploration!
Luke Royak's Personal Brand Exploration!Luke Royak's Personal Brand Exploration!
Luke Royak's Personal Brand Exploration!
 
han han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi samahan han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi sama
 
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
Transferable Skills - Your Roadmap - Part 1 and 2 - Dirk Spencer Senior Recru...
 
一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
一比一原版(TMU毕业证)多伦多都会大学毕业证如何办理
 
The Impact of Artificial Intelligence on Modern Society.pdf
The Impact of Artificial Intelligence on Modern Society.pdfThe Impact of Artificial Intelligence on Modern Society.pdf
The Impact of Artificial Intelligence on Modern Society.pdf
 
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
 
Digital Marketing Training In Bangalore
Digital  Marketing Training In BangaloreDigital  Marketing Training In Bangalore
Digital Marketing Training In Bangalore
 
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
原版制作(RMIT毕业证书)墨尔本皇家理工大学毕业证在读证明一模一样
 
Personal Brand Exploration Comedy Jxnelle.
Personal Brand Exploration Comedy Jxnelle.Personal Brand Exploration Comedy Jxnelle.
Personal Brand Exploration Comedy Jxnelle.
 

Intro to Python with GPIO

  • 1. Introduction to PythonIntroduction to Python ProgrammingProgramming
  • 2. Why Python?Why Python?  Python is what is referred to as an object-oriented programming language (OOP)  Python is a general purpose programming language. That means you can use Python to write code for a number of programming tasks. ◦ Google search engine ◦ Gaming ◦ Processing financial transactions ◦ Data Analytics ◦ Physical Programming  Simple  Less Syntax  Extensive User Community  Interpreted
  • 3. Interpreted?Interpreted? Python is interpreted, which means that python code is translated and executed by an interpreter one statement at a time. This means you can run commands/code on the command prompt… Through a command prompt with a text file… Using an IDE
  • 4. What Does It Look Like?What Does It Look Like?
  • 5. Parts of a Python ProgramParts of a Python Program Def: Source Code is the program text entered into an interpreter by the programmer. ◦ The saved file is referred to as, the source file. ◦ The main file in a python program, called main ◦ Can program on the command prompt The extension to a python source file is “.py” ◦ Xcel - .xls ◦ Power Point - .ppt Two main parts to a source file ◦ Modules ◦ Main code
  • 6. Good Programming ProclamationsGood Programming Proclamations Using comments to denote programs or sections of code ◦ A comment beginning with # is called a single-line comment because it terminates at the end of the current line. ◦ You also may use a multi-line comment—possibly containing many lines—begins with ’’’ and ends with ’’’. You use blank lines, space characters and tab characters (i.e., “tabs”) to make programs easier to read. ◦ Together, these characters are known as white space. ◦ White-space characters are USUALLY ignored by the interpreter. ◦ Python has its own rules with white space
  • 7. ModulesModules  A module is a python source file that has prewritten python code.  These predefined files allow users to utilize code that has been previously developed. ◦ Don’t have to recreate the wheel, just use the wheel and improve on the technology.  math  time  gpiozero  os  Code: Importing modules  import module_name  from module_name import class_name
  • 8. ExpressionsExpressions • A programming expression is a combination of symbols to represent a value. • One side of an equation • Ex. • 5+7 • False • print() • led.on()
  • 9. Printing a Line of TextPrinting a Line of Text print(“ “) Anything placed inside the quotes will be printed on the screen upon execution of the print command.
  • 10. Manipulating TimeManipulating Time The time module is a popular module which provides functions for working with times and converting between them. ◦ sleep ◦ local time ◦ epoch time Code: ◦ Importing time module  import time ◦ Using time functions  time.sleep(#)  time.localtime(time.time())
  • 11. Manipulating LED’sManipulating LED’s  The Raspberry Pi comes with a library RPi.GPIO that allow the manipulation of GPIO pins: ◦ Setup pins as inputs or outputs ◦ Read inputs, Set output levels ◦ Cleanup  Code: ◦ Importing gpio module  import RPi.GPIO as GPIO  GPIO.setmode(GPIO.BCM) ◦ Setup an LED  GPIO.setup(pin#, GPIO.OUT) ◦ Using led functions  GPIO.output(pin#,GPIO.HIGH)  GPIO.output(pin#,GPIO.LOW)
  • 12. CheckpointCheckpoint 1. What is an IDE? 2. What is a comment and its importance? 3. How is white space used in programming? 4. What are modules? 5. Name 2 modules

Editor's Notes

  1. Common elements in programming languages: Key Words Programmer-Defined Identifiers Operators Punctuation Syntax
  2. Where have you heard of expressions before? Math class and what were they
  3. Cleanup()