Reader small image

You're reading from  Practical Python Programming for IoT

Product typeBook
Published inNov 2020
Reading LevelIntermediate
PublisherPackt
ISBN-139781838982461
Edition1st Edition
Languages
Right arrow

Imports

At the top of the source code file, we see the following imports:

import logging
from flask import Flask, request, render_template # (1)
from flask_restful import Resource, Api, reqparse, inputs # (2)
from gpiozero import PWMLED, Device # (3)
from gpiozero.pins.pigpio import PiGPIOFactory

The Flask-related imports we see on lines (1) and (2) are all of the classes and functions of Flask and Flask-RESTful that we will require in our server. You will notice on line (3), we're importing PWMLED not LED as we have done in previous chapters. In this example, we're going to change the brightness of our LED rather than just turning it on and off. We'll cover more about PWM and  PWMLED as we proceed with this chapter.

Next, in our source code, we start to work with Flask and the Flask-RESTful extension.

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Practical Python Programming for IoT
Published in: Nov 2020Publisher: PacktISBN-13: 9781838982461