Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Programming for Arduino

You're reading from   Python Programming for Arduino Develop practical Internet of Things prototypes and applications with Arduino and Python

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781783285938
Length 400 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Pratik Desai Pratik Desai
Author Profile Icon Pratik Desai
Pratik Desai
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started with Python and Arduino FREE CHAPTER 2. Working with the Firmata Protocol and the pySerial Library 3. The First Project – Motion-triggered LEDs 4. Diving into Python-Arduino Prototyping 5. Working with the Python GUI 6. Storing and Plotting Arduino Data 7. The Midterm Project – a Portable DIY Thermostat 8. Introduction to Arduino Networking 9. Arduino and the Internet of Things 10. The Final Project – a Remote Home Monitoring System 11. Tweet-a-PowerStrip Index

The fundamentals of Python programming

If you have previous experience of working with any other programming language, Python is very easy to get started with. If you have never done programming before, this section will walk you through some of the basics of Python. If you have already worked with Python, you should skip this section and move on to the next one.

Assuming that the setup instructions are followed correctly, let's open the Python interpreter by executing the Python command at the terminal or the command prompt. You should get results similar to those displayed in the following screenshot. If you have installed Python by downloading the setup files from the website, you should have the Python integrated development environment (IDLE) installed as well. You can also start the Python interpreter by opening its IDLE from the location where it was installed.

As you can see, after printing some system information, the interpreter opens a prompt with three greater-than signs (>>>), which is also known as the primary prompt. The interpreter is now in the interactive mode and it is ready to execute scripts from the prompt.

The fundamentals of Python programming

To close the interactive mode of the Python interpreter, run the either exit() or quit(), at the primary prompt. Another method to exit from the interactive mode is to use the keyboard shortcut Ctrl + D.

Note

Note that Python's built-in functions are case sensitive. This means the following:

exit() ≠ EXIT() ≠ Exit()

The official Python website provides comprehensive tutorials for beginners to get started with Python programming. It is highly recommended that you visit the official Python tutorials at https://docs.python.org/2/tutorial/index.html if you are looking for detailed programming tutorials as compared to the upcoming brief overviews.

You have been reading a chapter from
Python Programming for Arduino
Published in: Feb 2015
Publisher:
ISBN-13: 9781783285938
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image