1. Trang chủ
  2. » Công Nghệ Thông Tin

Python programming for arduino (2015)

400 5 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 400
Dung lượng 12,4 MB

Nội dung

Python Programming for Arduino Develop practical Internet of Things prototypes and applications with Arduino and Python Pratik Desai BIRMINGHAM MUMBAI Python Programming for Arduino Copyright © 2015 P.

Python Programming for Arduino Develop practical Internet of Things prototypes and applications with Arduino and Python Pratik Desai BIRMINGHAM - MUMBAI Python Programming for Arduino Copyright © 2015 Packt Publishing All rights reserved No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented However, the information contained in this book is sold without warranty, either express or implied Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information First published: February 2015 Production reference: 1230215 Published by Packt Publishing Ltd Livery Place 35 Livery Street Birmingham B3 2PB, UK ISBN 978-1-78328-593-8 www.packtpub.com Credits Author Pratik Desai Reviewers Project Coordinator Milton Dsouza Proofreaders Juan Ramón González Safis Editing Marco Schwartz Maria Gould Josh VanderLinden Ameesha Green Paul Hindle Commissioning Editor Saleem Ahmed Indexer Mariammal Chettiyar Acquisition Editor James Jones Graphics Abhinash Sahu Content Development Editor Priyanka Shah Production Coordinator Manu Joseph Technical Editor Ankita Thakur Cover Work Manu Joseph Copy Editors Jasmine Nadar Vikrant Phadke About the Author Pratik Desai, PhD, is the Principal Scientist and cofounder of a connected devices start-up, Imbue Labs, where he develops scalable and interoperable architecture for wearable devices and Internet of Things (IoT) platforms during the day At night, he leads the development of an open source IoT initiative, the Semantic Repository of Things Pratik has years of research and design experience in various layers of the IoT and its predecessor technologies such as wireless sensor networks, RFID, and machine-to-machine (M2M) communication His domains of expertise are the IoT, Semantic Web, machine learning, robotics, and artificial intelligence Pratik completed his MS and PhD from Wright State University, Ohio, and collaborated with the Ohio Center of Excellence in Knowledge-enabled Computing (Kno.e.sis) during his doctoral research His doctoral research was focused on developing situation awareness frameworks for IoT devices, enabling semantic web-based reasoning and handling the uncertainty associated with sensor data In his personal life, Pratik is an avid DIY junkie and likes to get hands-on experience on upcoming technologies He extensively expresses his views on technology and shares interesting developments on Twitter (@chheplo) I would like to dedicate the book to my parents, who were responsible for building the foundation of what I am today The book would not have been possible without the patience, support, and encouragement from my beloved wife, Sachi I would also like to thank her for landing her photography skills that were used in development of some of the important images used in the book I would also like to extend my sincere gratitude to the editors for their valuable feedbacks About the Reviewers Juan Ramón González is a technical engineer of computer systems and lives in Seville (Andalusia, Spain) For the past years, he has been working on free software-based projects for the regional Ministry of Education by using Python, C++, and JavaScript, among other programming languages He is one of the main members of the CGA project in Andalusia (Centro de Gestión Avanzado or Advanced Management Center), which manages a network with more than 4,000 servers with Debian and 500,000 client computers that run Guadalinex, a customized Ubuntu-based operating system for Andalusian schools As a software developer who has a passion for electronics and astronomy, he started one of the first projects to control a telescope with the Arduino microcontroller by using a computer with the Stellarium software and a driver developed with Python to communicate with the telescope This project's sources are published on the collaborative platform GitHub You can see the whole code and the prototype at https://github.com/juanrmn/Arduino-Telescope-Control Marco Schwartz is an electrical engineer, entrepreneur, and blogger He has a master's degree in electrical engineering and computer science from Supélec, France, and a master's degree in micro engineering from EPFL, Switzerland Marco has more than years of experience working in the domain of electrical engineering His interests gravitate around electronics, home automation, the Arduino and the Raspberry Pi platforms, open source hardware projects, and 3D printing He runs several websites around Arduino, including the Open Home Automation website that is dedicated to building home automation systems using open source hardware Marco has written a book on home automation and Arduino called Arduino Home Automation Projects, Packt Publishing He has also written a book on how to build Internet of Things projects with Arduino called Internet of Things with the Arduino Yun, Packt Publishing Josh VanderLinden is a lifelong technology enthusiast who has been programming since the age of 10 He enjoys learning and becoming proficient with new technologies He has designed and built software, ranging from simple shell scripts to scalable backend server software to interactive web and desktop user interfaces Josh has been writing software professionally using Python since 2007, and he has been building personal Arduino-based projects since 2010 www.PacktPub.com Support files, eBooks, discount offers, and more For support files and downloads related to your book, please visit www.PacktPub.com Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy Get in touch with us at service@packtpub.com for more details At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library Here, you can search, access, and read Packt's entire library of books Why subscribe? • Fully searchable across every book published by Packt • Copy and paste, print, and bookmark content • On demand and accessible via a web browser Free access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view entirely free books Simply use your login credentials for immediate access Table of Contents Preface 1 Chapter 1: Getting Started with Python and Arduino Introduction to Python Why we use Python When we use other languages Installing Python and Setuptools 10 Installing Python 10 Linux 10 Ubuntu 11 Fedora and Red Hat 11 Windows 11 Mac OS X 14 Installing Setuptools 14 Linux 15 Windows 15 Mac OS X 16 Installing pip 16 Installing Python packages 17 The fundamentals of Python programming 18 Python operators and built-in types 19 Operators 20 Built-in types 20 Data structures 22 Lists 22 Tuples 24 Sets 25 Dictionaries 25 Controlling the flow of your program The if statement The for statement The while statement 25 26 26 26 Index A Amazon AWS platform about 289 account, setting up 290-292 URL 289 analog digital buzzer URL 102 architecture, IoT web applications about 263-266 computation layer 263 interfacing layer 263 physical layer 263 Arduino about 29 computer networking 202 history 29 interfacing, with Python 90 objectives 29, 30 reference link 49 Uno board 31, 32 URL, for installation on Linux 51 variants 30 Arduino board connection establishing 50 establishing, on Linux 50, 51 establishing, on Mac OS X 51, 52 establishing, on Windows 52 troubleshooting 52, 53 Arduino data plotting, from CSV file 160-162 storing, in CSV file 152-155 Arduino Ethernet library about 210, 211 Client class 212, 213 Ethernet class 211 IPAddress class 212 Server class 212 URL 211 Arduino Ethernet Shield about 208, 209 URL 209 Arduino IDE about 31, 34 examples, using 37 installing 32 installing, on Linux 33 installing, on Mac OS X 33 installing, on Windows 33 libraries 36 serial monitor, using 40 sketch 34, 35 sketch, compiling 38, 39 sketch, uploading 38, 39 URL, for built-in examples 37 URL, for installation on Fedora 33 URL, for installation on Ubuntu 33 URL, for setup file 33 Arduino, interfacing with Xively about 275 advanced code, for data upload and download 280, 281 Arduino data, uploading 275-277 data, downloading to Arduino 277-279 Arduino interrupts about 180 reference link 181 using 180, 181 Arduino pins configuring 93 configuring, with direct method 94, 95 data, reporting 96 monitoring 97 pin modes, assigning 95, 96 read() method, using 98 working with 96 write() method, using 97, 98 Arduino programming about 41 comments 41 constants 42 conversion functions 44 data types 42, 43 functions 44 statements 44 variables 41 Arduino sketch, monitoring station about 319 actuator actions, subscribing to 320 interrupt, programming 321 sensor information, publishing 319, 320 Arduino WiFi Shield about 209 URL 209 Arduino Yún about 210 URL 210 array data type 43 B BH1750 light sensor interfacing, Arduino used 117-119 interfacing, PyMata library used 121, 122 Bluetooth 201 boolean data type 43 breadboard history 74 reference link 74 URL 73 using 73, 74 broker 240 built-in functions about 27 conversion methods 27 math operations 27 string operations 28 URL 28 built-in types about 19-22 data structures 22 Button() widget about 127, 130 using 130-133 buzzer connections 102 Python code 103, 104 using 102 byte data type 43 C callback 143 Carriots 274 char data type 43 Checkbox() widget 127 Checkbutton() widget about 139 used, for selecting LEDs 139-141 Client class 212, 213 close() method used, for closing file 149 comma separated values file See CSV file comments about 41 block comment 41 single-line or inline comment 41 computer networking about 202 Arduino Ethernet library 210, 211 IP address, obtaining 203 networking extensions, for Arduino 208 web server, building with Arduino 213-218 constants 42 control center, remote home monitoring system about 322 architecture 322, 323 buzzer status, checking 328, 329 buzzer status, updating 328, 329 GUI, creating with Tkinter 324, 325 Mosquitto broker, communicating with 325 Python code 323, 324 setting up, on Raspberry Pi 330-332 [ 368 ] E system status, calculating 326 testing, with monitoring station 329, 330 Xively, communicating with 327, 328 conversion functions about 44 byte() 44 char() 44 float() 44 int() 44 CSV file about 151 Arduino data, storing 152-155 data, plotting 160-162 used, for storing data 151, 152 custom cloud platform, IoT Amazon AWS platform 289 configuring 288, 289 cyber-physical systems 263 Elastic Computer Cloud service (EC2 service) 289 electronic components interfacing, with Arduino 91 End of Line (EOL) 65 Entry() widget about 127, 133 used, for providing manual user inputs 133, 134 Ethernet class 211 ez_setup.py file URL, for downloading 15, 16 F D data structures about 22 dictionaries 25 list 22-24 sets 25 tuples 24 URL 25 data types about 42 array 43 boolean 43 byte 43 char 43 float 43 int 43 void 42 DC motors connections 105, 106 Python code 106 using 105 do-it-yourself (DIY) projects 29 Dual in-line Package (DIP) 74 Dynamic Host Control Protocol (DHCP) 211 Fedora/Red Hat Linux Python, installing 11 files closing, close() method used 149 manipulating, with open() method 148 read() method, using 149, 150 with statement, using 150 working with 148 write() method, using 149 Firmata about 53 and pySerial library, bridging 65, 66 disadvantages 122 StandardFirmata sketch, uploading to Arduino board 54-57 testing 57-62 URL 54, 59 float data type 43 formatting tool, SD card URL, for downloading 191 for statement 26 Fritzing about 58 URL 72, 73 using 72, 73 functions about 44 loop() function 45 [ 369 ] pinMode() function 45 setup() function 45 functions, pins analogRead() function 46 analogWrite() function 46 digitalRead() function 46 digitalWrite() function 46 HIH-4030 humidity sensor using 172 home area network (HAN) 202 Homebrew installing 16 URL 16 Hypertext Transfer Protocol (HTTP) 201 G I general-purpose input/output (GPIO) pins 174 graphical user interfaces (GUIs) Grid 130 Grid geometry manager 137-139 GUI, thermostat button interrupts, used for changing temperature unit 185 button interrupts, used for swapping between GUI and plot 186 button interrupts, using 185 designing, Tkinter used 181-183 percentage humidity, plotting with matplotlib 184 pySerial, used for streaming sensor data 181 I2C about 89 reference link 114 if statement 26 input/output (I/O) pins 30 installation, Arduino IDE on Linux 33 on Mac OS X 33 on Windows 33 installation, paho-mqtt library 248 installation, pip 16 installation, PubSubClient library 245 installation, pySerial library 62 installation, Python about 10 on Fedora/Red Hat Linux 11 on Linux 10 on Mac OS X 14 on Ubuntu 11 on Windows 11-13 installation, Python packages 17 installation, Setuptools about 14 on Linux 15 on Mac OS X 16 on Windows 15 installation, web.py 219, 220 int data type 43 integrated circuit (IC) 112 integrated development environment (IDE) 18, 32 inter-integrated circuit See I2C Internet Protocol (IP) 203 Internet of Things (IoT) about 261 cloud applications, developing with Python and Xively 274 H hardware components, Raspberry Pi display cable 190 keyboard 190 mouse 190 power cable 189 Raspberry Pi 189 SD card 190 USB hub (optional) 190 hardware components, Tweet-a-PowerStrip about 347 PowerSwitch Tail 349, 350 relays 348 hardware system design, motion-triggered LEDs breadboard, using 73, 74 Fritzing, using 72, 73 hardware prototype, designing 74-76 help() function 159 [ 370 ] custom cloud platform 288 getting started process 262, 263 hardware design 266, 267 IoT cloud platform, on EC2 instance basic security, configuring 300, 301 basic security, testing 300, 301 creating 295, 296 Mosquitto service, testing 300 necessary packages, installing on AWS 296, 297 project, testing on instance 301, 302 project, uploading on instance 301, 302 testing 299 virtual instance security, configuring 297-299 IoT cloud platforms 2lemetry 267 Carriots 267, 274 ThingSpeak 267, 273 Xively 267, 268 IP address about 203 obtaining 203 obtaining, for Linux 206, 207 obtaining, for Mac OS X 205, 206 obtaining, for Windows 204 IPAddress class 212 L Label() widget about 127-129, 141 used, for monitoring I/O pins 141-144 least significant bit (LSB) 116 LED brightness, controlling with PWM 107 connections 107, 108 Python code 108, 109 libraries, Arduino IDE about 36 URL 36 Line feed + Carriage Return (LF + CR) 65 Linux Arduino board connection, establishing 50, 51 Arduino IDE, installing 33 IP address, obtaining 206, 207 Python, installing 10 Setuptools, installing 15 Listbox() widget about 141 URL 141 local area network (LAN) 202 localhost IP address 203 loop() function about 45 using 80 M Mac OS X Arduino board connection, establishing 51, 52 Arduino IDE, installing 33 IP address, obtaining 205, 206 matplotlib, configuring 156, 157 Python, installing 14 SD card, preparing 191 Setuptools, installing 16 matplotlib about 155 configuring, on Mac OS X 156, 157 configuring, on Windows 156 installation errors, troubleshooting 157, 158 reference link 158 setting up, on Ubuntu 158 upgrading 157 URL 155, 156 used, for plotting random numbers 158-160 media access control (MAC) address 203 Message Queue Telemetry Transport See MQTT monitoring station, remote home monitoring system Arduino sketch 319 defining 315-318 Mosquitto about 202, 242 initialization 243, 244 setting up 242, 243 URL 242 most significant bit (MSB) 116 motion-triggered LEDs developing 68 [ 371 ] examples 68 hardware connections, testing 77, 78 hardware system design 71 online resources 68 project goals 68 software flow design 70, 71 motion-triggered LEDs, components Arduino board 70 breadboard 70 computer 70 LEDs 70 PIR sensors 69 resistors 70 USB cable 70 wires 70 motion-triggered LEDs, using Arduino sketch coding 78, 79 custom Arduino functions, using 80, 81 developing 78 loop() function, using 80 project setup 78 setup() function, using 80 testing 81, 82 troubleshooting 82 motion-triggered LEDs, using Python and Firmata coding 84, 85 developing 82 project setup 82 pyFirmata methods, using 85, 86 Python executable files, using 83 Python functions, using 86 testing 87 troubleshooting 87, 88 MQTT about 240, 241 Mosquitto 242 URL 241 MQTT Gateway Arduino MQTT client, developing 252, 253 developing, for Arduino 251, 252 developing, Mosquitto used 254, 255 extending, web.py used 255, 256 testing 256-258 MQTT, on Arduino Arduino MQTT client, developing 245-247 PubSubClient library, using 244 MQTT, on Python paho-mqtt library, using 247-250 N Nest Thermostat URL 170 networking fundamentals 202 home area network (HAN) 202 Internet Protocol (IP) 203 IP address 203 local area network (LAN) 202 localhost IP address 203 media access control (MAC) address 203 protocols 203 wide area network (WAN) 202 networking extensions, for Arduino about 208 Arduino Ethernet Shield 208, 209 Arduino WiFi Shield 209 Arduino Yún 210 newline character about 65 URL 65 New Out Of Box Software (NOOBS) 190 NumPy package URL 156 O open() method modes 148 used, for manipulating files 148 operators 19, 20 P Pack geometry manager 129, 130 paho-mqtt library about 247 installing 248 using 248-250 passive infrared (PIR) sensor about 68 URL 69 using 69 [ 372 ] PEP-8 URL 20 physical systems 262 pinMode() function 45 pip installing 16 plot() function 159 portable TFT LCD display configuring, with Raspberry Pi OS 196, 197 connecting, GPIO used 195, 196 GUI, optimizing 197-199 using 194 potentiometer connections 100 Python code 100-102 PowerSwitch Tail URL 349 Processing 41 protocols 203 prototyping 90 prototyping templates, using Firmata about 99 buzzer, using 102 DC motor, using 105 LED 107 potentiometer 99, 100 servomotors, using 109 prototyping, thermostat about 178 Arduino sketch 178, 179 humidity sensor, interfacing 179, 180 light sensor, interfacing 180 temperature sensor, interfacing 179 troubleshooting 186, 187 prototyping, with I2C protocol about 112-114 Arduino examples 114 BH1750 light sensor, using Arduino 117-119 BH1750 light sensor, using PyMata library 121, 122 PyMata library, using 119, 120 pySerial commands, using 122 TMP102 temperature sensor, using Arduino 114-116 TMP102 temperature sensor, using PyMata library 120, 121 PubSubClient library installing 245 URL 245 using 244 pulse-width modulation (PWM) 31 push button switch using 173 pyFirmata methods exit() 98 get_firmata_version() 98 pass_time(seconds) 98 pulseIn/pulseOut 99 servo_config(pin,min_pulse=544,max_ pulse=2400,angle=0) 98 shiftIn/shiftOut 99 used, for configuring Arduino pins 93 used, for setting up Arduino board 91-93 used, for working with Arduino pins 96 working with 91 PyGTK URL 126 PyPI about URL pyplot framework about 158 figure() function 158 show() method 160 PyQt URL 126 pySerial commands used, for closing port 123 used, for connecting with serial port 122 used, for flushing port to avoid buffer overflow 123 used, for reading port 123 using 122 pySerial library about 62 and Firmata, bridging 65, 66 example 63, 64 installing 62 URL 63 PySide URL 126 [ 373 ] Python about benefits 8, installing 10 installing, on Fedora/Red Hat Linux 11 installing, on Linux 10 installing, on Mac OS X 14 installing, on Ubuntu 11 installing, on Windows 11-13 packages, installing 17, 18 pip, installing 16 URL usage considerations Python context manager reference link 150 Python data, downloading to Xively about 284 basic method, for retrieving data 284, 285 custom notifications, from Xively 287, 288 data retrieving, from web.py web interface 285, 286 triggers 287 Python data, uploading to Xively about 281 basic method, for sending data 282, 283 web interface used 283, 284 Python executable files using 83 Python functions def keyword 86 using 86 Python GUI first program 127, 128 Python-Arduino project, remaking 144-146 Tkinter 126, 127 working with 125, 126 Python programming built-in types 19-22 comments 19 for statement 26 fundamentals 18, 19 if statement 26 operators 19, 20 program flow, controlling 25 while statement 26, 27 R Radiobutton() widget about 141 URL 141 Raspberry Pi about 188, 189 configuring 189 hardware components 189 operating system, installing 189 Raspbian 189 SD card, preparing 190-192 setup process 192-194 URL 189, 190 versions 189 read() method using 149, 150 real-time Arduino data plotting 163-166 remote home monitoring system about 305 cloud-based features, expanding 341, 342 control center, using 322 design methodology 306, 307 development stages, defining 315 extending 338 hardware components 313, 314 hardware enclosures, creating 342, 343 improved intelligence, for situation awareness 342 monitoring station, Arduino used 315 multiple monitoring stations, utilizing 339 project goals 307 project overview 307 project requirements 308, 309 sensory capabilities, extending 339, 340 system architecture, designing 309, 310 testing 321, 336 troubleshooting 336-338 UX flow, defining 311, 312 UX, improving 341 web application 332 Representation State Transfer (REST) 219 RESTful web applications architecture 236, 237 Arduino sketch 237 [ 374 ] designing 230, 231 developing, with Arduino and Python 230 GET request, generating 231, 232 GET request, handling with web.py 233 GET request, implementing 231 POST request, generating 234, 235 POST request, handling with web.py 235, 236 POST request, implementing 234 resource-constrained messaging protocol, using 239, 240 web.py web application 238, 239 S Scale() widget about 127, 135 used, for adjusting brightness of LED 135-137 SD card preparing 190 preparing, from Mac OS X 191 preparing, from Ubuntu Linux 191, 192 preparing, from Windows 191 reference link 190, 192 Secure Shell (SSH) protocol 294 Serial Clock Line (SCL) 113 Serial Data Line (SDA) 113 Serial Monitor window using 40 serial peripheral interface (SPI) 91 Server class 212 servomotors connections 110 Python code 110, 111 using 109 setup() function 80 Setuptools about 14 installing 14 installing, on Linux 15 installing, on Mac OS X 16 installing, on Windows 15 sketch about 34, 35 compiling 38-40 uploading 38-40 sketchbook 34 slicing 23 StandardFirmata firmware 90 statements 44, 46 subnetwork/subnet about 215 reference link 215 subroutines/procedures See  functions system architecture, remote home monitoring system cloud services 311 control center 311 designing 309, 310 monitoring station 311 T Templetor about 223 URL 223 thermostat building 169 deploying, Raspberry Pi used 187, 188 GUI, designing 181 hardware design 174-176 plot, designing 181 project background 170 project description 169, 170 project goals 170, 171 project stages 170, 171 prototyping 178 required components, identifying 171-173 software flow, for user experience design 176, 177 thermostat, prototyping Arduino interrupts, using 180, 181 thermostat, using Raspberry Pi deploying 187, 188 GUI, optimizing for TFT LCD screen 197-199 portable TFT LCD display, using 194 TFT LCD, configuring 196, 197 TFT LCD connection, using GPIO 195, 196 troubleshooting 199, 200 thin-film transistor liquid-crystal display (TFT LCD) 174 [ 375 ] ThingSpeak 273 Tkinter about 126, 127 Button() widget 127 Checkbox() widget 127 Entry() widget 127 Grid geometry manager 137-139 Label() widget 127 Pack geometry manager 129, 130 plots, integrating 166-168 Scale() widget 127 Tk() widget 127 URL 126 Tkinter class about 143 BooleanVar() method 143 update_idletasks method 143 update method 143 Tk() widget 128, 129 TMP102 temperature sensor interfacing, Arduino used 114-116 interfacing, PyMata library used 120, 121 transistor terminals reference link 106 troubleshooting, Arduino board connection 52, 53 Tweet-a-PowerStrip about 345 Arduino code 354-356 deployment stage 352 development stage 352 hardware components 347 hardware design 353 multiple features, adding 364, 365 project overview 345 project requirements 346 Python code 357-362 Python software flow 357 smart power strip with Arduino 353 system architecture 346, 347 testing 363 troubleshooting 363 Twitter application, setting up 359-361 user experience flow 350, 351 tweets about 345 URL 345 U Ubuntu matplotlib, setting up 158 Python, installing 11 SD card, preparing 191, 192 Universal Serial Bus (USB) 40 Uno board 31, 32 V variables 41 virtual instance, on AWS EC2 service creating 292-294 logging into 294, 295 void data type 42 W web application, remote home monitoring system about 332 architecture 332, 333 Python web application, hosted on Amazon AWS 333-335 testing 335-338 web.py basic concepts 221 forms 224, 225 GET methods 222, 223 installing 219, 220 POST methods 222, 223 templates 223, 224 URLs, handling 222 used, for developing web applications 219 used, for implementing web applications 220, 221 with Arduino serial interface 225-230 while statement 26, 27 wide area network (WAN) 202 Windows Arduino board connection, establishing 52 Arduino IDE, installing 34 IP address, obtaining 204 matplotlib, configuring 156 Python, installing 11-13 SD card, preparing 191 Setuptools, installing 15 [ 376 ] Wire library about 114 URL 114 Wiring 41 with statement 150 World Wide Web (WWW) 230 write() method used, for working with files 149 wxPython URL 126 X Xively 332 Xively, IoT cloud platforms about 268 account, setting up 268, 269 Arduino, interfacing with 275 working with 270-273 Z ZigBee 201 [ 377 ] Thank you for buying Python Programming for Arduino About Packt Publishing Packt, pronounced 'packed', published its first book, Mastering phpMyAdmin for Effective MySQL Management, in April 2004, and subsequently continued to specialize in publishing highly focused books on specific technologies and solutions Our books and publications share the experiences of your fellow IT professionals in adapting and customizing today's systems, applications, and frameworks Our solution-based books give you the knowledge and power to customize the software and technologies you're using to get the job done Packt books are more specific and less general than the IT books you have seen in the past Our unique business model allows us to bring you more focused information, giving you more of what you need to know, and less of what you don't Packt is a modern yet unique publishing company that focuses on producing quality, cutting-edge books for communities of developers, administrators, and newbies alike For more information, please visit our website at www.packtpub.com About Packt Open Source In 2010, Packt launched two new brands, Packt Open Source and Packt Enterprise, in order to continue its focus on specialization This book is part of the Packt Open Source brand, home to books published on software built around open source licenses, and offering information to anybody from advanced developers to budding web designers The Open Source brand also runs Packt's Open Source Royalty Scheme, by which Packt gives a royalty to each open source project about whose software a book is sold Writing for Packt We welcome all inquiries from people who are interested in authoring Book proposals should be sent to author@packtpub.com If your book idea is still at an early stage and you would like to discuss it first before writing a formal book proposal, then please contact us; one of our commissioning editors will get in touch with you We're not just looking for published authors; if you have strong technical skills but no writing experience, our experienced editors can help you develop a writing career, or simply get some additional reward for your expertise C Programming for Arduino ISBN: 978-1-84951-758-4 Paperback: 512 pages Learn how to program and use Arduino boards with a series of engaging examples, illustrating each core concept Use Arduino boards in your own electronic hardware and software projects Sense the world by using several sensory components with your Arduino boards Create tangible and reactive interfaces with your computer IPython Interactive Computing and Visualization Cookbook ISBN: 978-1-78328-481-8 Paperback: 512 pages Over 100 hands-on recipes to sharpen your skills in high-performance numerical computing and data science with Python Leverage the new features of the IPython Notebook for interactive web-based big data analysis and visualization Become an expert in high-performance computing and visualization for data analysis and scientific modeling A comprehensive coverage of scientific computing through many hands-on, example-driven recipes with detailed, step-by-step explanations Please check www.PacktPub.com for information on our titles Raspberry Pi Home Automation with Arduino ISBN: 978-1-84969-586-2 Paperback: 176 pages Automate your home with a set of exciting projects for the Raspberry Pi Learn how to dynamically adjust your living environment with detailed step-by-step examples Discover how you can utilize the combined power of the Raspberry Pi and Arduino for your own projects Revolutionize the way you interact with your home on a daily basis BeagleBone Robotic Projects ISBN: 978-1-78355-932-9 Paperback: 244 pages Create complex and exciting robotic projects with the BeagleBone Black Get to grips with robotic systems Communicate with your robot and teach it to detect and respond to its environment Develop walking, rolling, swimming, and flying robots Please check www.PacktPub.com for information on our titles .. .Python Programming for Arduino Develop practical Internet of Things prototypes and applications with Arduino and Python Pratik Desai BIRMINGHAM - MUMBAI Python Programming for Arduino. .. have configured a programming environment for both Python and Arduino for your favorite operating system If you are a beginner with either or both platforms (that is, Python and Arduino) , it is... packages Python has a huge open source community that drives forth the effort for continuous improvement of Python as a programming language The Python community is also responsible for the development

Ngày đăng: 29/08/2022, 22:36

w