Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning Beaglebone Python Programming

You're reading from  Learning Beaglebone Python Programming

Product type Book
Published in Jul 2015
Publisher
ISBN-13 9781784399702
Pages 196 pages
Edition 1st Edition
Languages

Taking advantage of the OS


Since the BeagleBone is running a full GNU/Linux operating system, there are plenty of great tools available for us to take advantage of. Let's look at a couple of the advantages an OS gives you.

Multiprocessing

Every time you click on Run in Cloud9, it launches the program as a new process, so you can easily run many different programs simultaneously. Let's add a second transistor/LED circuit, this time using GPIO3_19 on P9.27.

For this, you will need:

  • Breadboard

  • 2x 5 mm LED

  • 2x 4.7 kΩ resistor

  • 2x 68 Ω resistor

  • 2x 2N3904 NPN transistor

  • Jumper wires

Wire it up on your breadboard as shown here:

Now create a new file called blink2.py, and this time, let's use PyBBIO, as shown in the following code:

from bbio import *

LED_PIN = GPIO3_19

def setup():
  pinMode(LED_PIN, OUTPUT)
 
def loop():
  digitalWrite(LED_PIN, HIGH)
  delay(250)
  digitalWrite(LED_PIN, LOW)
  delay(250)
   
run(setup, loop)

As you can see, this time, we're delaying the loop by 250 milliseconds or a quarter...

lock icon The rest of the chapter is locked
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 €14.99/month. Cancel anytime}