Reader small image

You're reading from  Wearable-Tech Projects with the Raspberry Pi Zero

Product typeBook
Published inJul 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781786468819
Edition1st Edition
Languages
Right arrow
Author (1)
Jon Witts
Jon Witts
author image
Jon Witts

Jon Witts has been working within the IT industry since 2002 and specifically within Educational IT since 2004. He was introduced to Linux back in 2001 through his collaboration with two German artists who were visiting the arts organisation he was then working with. Having studied Fine Arts and Educational Technology and sought to innovate with open and accessible digital technologies within his creative practice, Jon is happiest when deconstructing technology and finding its limits. Jon has embedded within his school the use of Raspberry Pi computers, as an integral part of the delivery of the school's Computer Science curriculum as well as to run various school clubs and projects. Jon is a Raspberry Pi Certified Educator and also helps to organise and run the Hull Raspberry Jam events. I would like to thank my wife, Sally and our three daughters for putting up with all the cables and compoents around the house, and not least for being so tolerant of the need to dodge the robots racing round the kitchen floor!
Read more about Jon Witts

Right arrow

Writing our main Python program

Connect your USB battery to the LED matrix and power up your Pi Zero, and then connect to your Pi Zero via SSH. Move into the Adafruit_DotStar_Pi directory by typing this:

cd ~/WearableTech/Chapter6/Adafruit_DotStar_Pi

We are going to make our Python program in this directory as it contains the necessary files to connect to the DotStar strip with Python. Open a new file in Nano by typing this:

nano ledBag.py

In the empty file that opens, type the following:

#! /usr/bin/python

import time
from random import randint
from dotstar import Adafruit_DotStar

# set up our strip
numpixels = 144
strip = Adafruit_DotStar(numpixels, 12000000, order='bgr')

# start our strip
strip.begin()
strip.setBrightness(32)

In this first section of our program, we are importing our required libraries, setting up the details for our strip, and the initializing the strip...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Wearable-Tech Projects with the Raspberry Pi Zero
Published in: Jul 2017Publisher: PacktISBN-13: 9781786468819

Author (1)

author image
Jon Witts

Jon Witts has been working within the IT industry since 2002 and specifically within Educational IT since 2004. He was introduced to Linux back in 2001 through his collaboration with two German artists who were visiting the arts organisation he was then working with. Having studied Fine Arts and Educational Technology and sought to innovate with open and accessible digital technologies within his creative practice, Jon is happiest when deconstructing technology and finding its limits. Jon has embedded within his school the use of Raspberry Pi computers, as an integral part of the delivery of the school's Computer Science curriculum as well as to run various school clubs and projects. Jon is a Raspberry Pi Certified Educator and also helps to organise and run the Hull Raspberry Jam events. I would like to thank my wife, Sally and our three daughters for putting up with all the cables and compoents around the house, and not least for being so tolerant of the need to dodge the robots racing round the kitchen floor!
Read more about Jon Witts