![]() ![]() To build the final circuit for the photo booth, it needs to be moved from the breadboard. Leave the LEDs plugged in the breadboard you will use them later on. Remaining side of switch -> power pin (either 5 volts or 3.3 volts) Once your wires are connected to the switch, connect the switch to the Raspberry Pi as shown in the diagram:Įither side of switch -> GPIO 18 (board pin 12) It helps to first twist the small strands of the wire together then create a small hook with the wire to hook around the screw post (clockwise, so the screw tightens the wire around the screw). The goal is to wrap the wire around the screw and to then capture it between the metal plates by tightening the screw. Use a small Phillips head screwdriver to loosen the two lower terminals on the switch. Cut off the end opposite the female header and strip the insulation off about 1/2" down. Make sure the jumper wires each have a female header at one end. Grab two jumper wires and a pair of angled wire cutters. The leads on this switch are the two bottom screw terminals. Time to read a switch! First, you need to connect jumper wires to the switch's leads so you can connect it to the Raspberry Pi. You can also run your script from the command line using Python 2 (cd to your folder boof if you're not there already): python testPytumblr.py If the post doesn't appear, double check that you correctly entered your four keys and Tumblr username, and that your Pi's internet connection is active. This is the exciting part! Go to your Tumblr page and check out the GIF! Swap "published" in your program to "draft" if you wish to create draft posts instead. When it has uploaded the GIF, "uploaded" will be printed in the Python shell window. Open the Python 2 IDLE editor and cut and paste your code, overwrite the Python 3 program and then run it. but you have already installed Pytumblr so why is Python saying it can't find the module? This is because Pytumblr doesn't support Python 3, it only works in Python 2. These are stored in a variable called tags used in client.create_photo(). If you wish, you may remove, substitute, or add to these tags. The program tags the uploaded photo for you with "raspberrypi" and "picamera". Put this in your testPytumblr.py file, updating the four keys and your username: import pytumblr Create a file using Python 2 IDLE's editor to make it easier to cut and paste your very long authorization keys. Let's put these codes to work and make a Python program that posts the animateMe.gif to your new Tumblr account. Either click the Python tab and copy the OAuth block, or in the top menu click Show Keys to see the token key and token secret codes along with the two codes you already have. Once logged into the developer console, you will see example code in several different languages.Click allow when asked if you want it to post on your behalf. Log into the developer console using your key and secret authorization codes.To access them again go to your Tumblr account page, choose Settings in the Account menu, and click on Apps. Copy and paste them somewhere safe, like a text file or email. After registration, you will get a consumer key and consumer secret. You only need to give basic information such as a title (try "My Raspberry Pi"), description, email, and website (use this one if you don't have one). ![]() Create a free Tumblr account and log in.This function uses four authorization codes generated by Tumblr:īefore you can use Tumblr’s API you must get four these keys (similar to passwords). A client is created in a Python program using a built-in function created in Pytumblr. To get an Raspberry Pi working with an API there will most likely already be a library out there for you to use. ![]() As the client, your Raspberry Pi will be asking Tumblr for data snippets so it can upload images to Tumblr’s remote server, resulting in the images being posted to a Tumblr account. The following exercise creates a conversation between your Raspberry Pi and Tumblr. Have your Raspberry Pi talk to Tumblr, Twitter, and to tweet, post images, and display weather forecasts. An API makes it easy for something like the Raspberry Pi to cut through all the data of a website to grab just the useful stuff. The Raspberry Pi can request and get information from other software applications online through an API ( Application Programming Interface). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |