element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi Projects
  • Products
  • Raspberry Pi
  • Raspberry Pi Projects
  • More
  • Cancel
Raspberry Pi Projects
Blog The Pi Powered Joke Machine - The Ultimate Raspberry Pi Bundle Blog post
  • Blog
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: mazzmn
  • Date Created: 3 Feb 2014 12:47 PM Date Created
  • Views 595 views
  • Likes 1 like
  • Comments 0 comments
  • rpibeginner
  • raspberrypi
  • ultimate
  • road_test
  • raspberry_pi_projects
Related
Recommended

The Pi Powered Joke Machine - The Ultimate Raspberry Pi Bundle Blog post

mazzmn
mazzmn
3 Feb 2014

I've been blogging about my experience in Road Test reviewing the Ultimate Raspberry Pi Bundle. As a part of this Road Test I'm creating a Fridge/Freezer Temperature Alarm system for our local food shelf, Channel 1. You can see where this Road Test started for me here

 

Here is a short video of a project I created as a way of learning the Raspberry Pi. The Joke Machine queries iheartquotes.com and displays a One-Liner in 16 char segments. It uses the momentary buttons found on the PiFace Control and Display to allow you to scroll forward and backward the joke and request a new joke.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image


To create the Joke Machine I had to do the following:

I found a website that provides free Quotes (including One-Liners which is what I used here). The quotes come back in basic text and so I figured a simply wget or curl example would work....I ended up using pycurl and not using python3. Seemed like I was having problems getting the pifacecad examples to both be using the same version fo Python. In fact many examples of using the buttons on the PiFaceCad required python3...which is fine, but I was running into problems getting pycurl to run in python3. So I ended up using the following style of handling multiple buttons on the PiFace https://gist.github.com/larsks/6161684

Install the PiFace Control And Display Example code

sudo apt-get install python{,3}-pifacecad

 

Install PyCurl

sudo aptitude install python-pycurl

 

Install TheQuoteMachine.py

This is the python script I created to query www.iheartquotes.com to get the one-liner, break it into 16 char segments and handle the buttons to allow users to scroll.
I posted the code for TheQuoteMachine.Py as an attachment in my previous blog post
PiFace Control & Display - The Ultimate Raspberry Pi Bundle

Don't forget to make it executable by running chmod +x /home/pi/bin/TheQuoteMachine.py

 

Push a Button, Get a Joke

Now you can run /home/pi/TheQuoteMachine.py  It will connect to the free service http://www.iheartquotes.com and display hilarious one-liners. It does this by getting the one-liner back in straight text, splitting it up into 16-Char wide segments and then allowing you to scroll up and down through those segments using the PiFace buttons.

 

The Quote Machine Buttons:

  • Button 1 is the back button
  • Button 2 is the advance display button
  • Button 3 is the New Quote button
  • Button 4 is the Quit Button
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube