So like I said in my previous post I’m attempting to make a dead simple Flickr uploader. Video explaining this setup here:
http://youtu.be/Ll0SOO-jmr4
Here’s a picture of how it’s all wired up, this will likely not change throughout the duration of the project:
Image generated by fritzing.
And here’s the python code, it’s very rudimentary:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
#time setup import time #GPIO setup import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) flickr_LED = 3 GPIO.setup(flickr_LED, GPIO.OUT) both_LED = 5 GPIO.setup(both_LED, GPIO.OUT) hdd_LED = 7 GPIO.setup(hdd_LED, GPIO.OUT) in_left = 11 GPIO.setup(in_left, GPIO.IN) in_right = 13 GPIO.setup(in_right, GPIO.IN) button = 16 GPIO.setup(button, GPIO.IN) uploading_LED = 26 GPIO.setup(uploading_LED, GPIO.OUT) ready_LED = 24 GPIO.setup(ready_LED, GPIO.OUT) b_LED = 22 GPIO.setup(b_LED, GPIO.OUT) def flickr_upload(): print "Uploading Photos To Flickr" GPIO.output(uploading_LED, True) GPIO.output(ready_LED, False) time.sleep(5) print "Flickr Upload Completed" GPIO.output(uploading_LED, False) GPIO.output(ready_LED, True) def hdd_upload(): print "Uploading Photos To the HDD" GPIO.output(uploading_LED, True) GPIO.output(ready_LED, False) time.sleep(5) print "HDD Upload Completed" GPIO.output(uploading_LED, False) GPIO.output(ready_LED, True) def both_upload(): print "Uploading Photos To Flickr and the HDD" GPIO.output(uploading_LED, True) GPIO.output(ready_LED, False) time.sleep(5) print "Double Upload Completed" GPIO.output(uploading_LED, False) GPIO.output(ready_LED, True) while 1: GPIO.output(ready_LED, True) GPIO.output(uploading_LED, False) GPIO.output(b_LED, False) if GPIO.input(in_left): #print "left" GPIO.output(flickr_LED, True) GPIO.output(both_LED, False) GPIO.output(hdd_LED, False) elif GPIO.input(in_right): #print "right" GPIO.output(flickr_LED, False) GPIO.output(both_LED, False) GPIO.output(hdd_LED, True) else: #print "mid" GPIO.output(flickr_LED, False) GPIO.output(both_LED, True) GPIO.output(hdd_LED, False) if GPIO.input(button): if GPIO.input(in_left): flickr_upload() elif GPIO.input(in_right): hdd_upload() else: both_upload() |
Thanks for reading!
Cool project! As you said this is the first part of the project so a lot of things are not set in stone. My first few questions
1. how were you thinking of solving the SD card reading part? An external usb one? Or do you have the OS on a USB stick and you can then use the existing SD reader on board?
2. do you feel it would be simpler/better or not to solve this project by using an arduino with a sd card shield instead?
Thank You, this is fascinating. I’ll keep on watching.
Hey! Thanks for the comment
I am right now working with an external usb SD card reader on the Pi, and I’m using an aptitude package called “usbmount” to interface with it.
This kind of thing is probably possible with an arduino, but the way I’m doing it now is much less expensive because I would need an Arduino, an SD card shield and an Ethernet shield. It would also be very difficult to interface with the Flickr API on an arduino, whereas the Pi can use the wrapper that already exists for python.
Thanks for reading, they’ll be a new post within 24 hours with a bit of progress.