Raspberry Pi and AVR Projects: Augmenting the Pi's ARM with the Atmel ATmega, ICs, and Sensors (Make)
Clare Bowman, Sjoerd Dirk Meijer, Brian Corteil, Lauren Orsini
Language: English
Pages: 254
ISBN: 1457186241
Format: PDF / Kindle (mobi) / ePub
As an incredibly cheap, credit-card sized computer, the Raspberry Pi is breaking down barriers by encouraging people of all ages to experiment with code and build new systems and objects; and this book provides readers with inspiring and insightful examples to explore and build upon. Written for intermediate to seasoned Raspberry Pi users, this book explores four projects from around the world, explained by their makers. These projects cover five major categories in the digital maker space: music, light, games, home automation, and the Internet of Things.
Beginning C# Object-Oriented Programming
PlayStation Mobile Development Cookbook
Professional C++ (Programmer to Programmer)
Real-Time Analytics: Techniques to Analyze and Visualize Streaming Data
Head First Android Development
12, 13, 15, 16, and 18. We’re using pins 11 (GPIO 17), 12 (GPIO 18), 13 (GPIO 27), and 15 (GPIO 22) for this project. Please look up these pins in Figure 3-42. Figure 3-42. GPIO pin numbering for Raspberry Pi B Warning The Raspberry Pi uses +3.3V internally, but can output +5V. When connecting a +5V (and even a +3.3V) pin with another GPIO pin, you can damage this pin, so be careful. Let’s start making the Scratch project. Open ScratchGPIO5 by double-clicking its icon on the Raspbery Pi
the whole, completed temp.py program one last time. You won’t be editing it anymore: import os import glob import time import MySQLdb import datetime from twilio.rest import TwilioRestClient client = TwilioRestClient(account='abc', token='123') db = MySQLdb.connect("localhost", "root", "password", "fishtank") def sendToSQL(inConn, tempVal): now = datetime.datetime.now() query = "INSERT INTO temperature (measurementTime, temperature) VALUES ('"+ now.strftime("%Y-%m-%d %H:%M:%S") + "', " +
the correct flash form the message ''' global flashFlag # allows access to the flashFlag flag flashFlag = True flashColour = flashColour.lower() # converts message to lower-case while flashFlag: if (flashColour == 'red'): flash(1,0,0) elif (flashColour == 'green'): flash(0,1,0) elif (flashColour == 'blue'): flash(0,0,1) else: # returns null for any other message and return to cycle colours return def lastMessage(lastMessageID): ''' checks last message returns message text and set messageFlag to
with special permissions (with the root user account) on the Raspberry Pi. To make sure the ShrimpKey can be used under the default user account “pi” (or any other user), you have to tell the Raspberry Pi that it’s safe to use USBasp devices with normal user accounts: > sudo nano /etc/udev/rules.d/99-usbasp.rules Type the following in nano (one line): ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", SUBSYSTEMS=="usb", ACTION=="add", MODE="0666", GROUP="plugdev" Press Ctrl-X, type Y, and press
!ledState; // update the LED pin itself: digitalWrite(ledPin, ledState); // send the string "Knock!" back to the computer, // followed by newline Serial.println("Knock!"); } delay(100); // delay to avoid overloading the serial port buffer } Assuming all goes well, you will see how the piezo is detected when the Arduino Knock sketch toggles the onboard LED on or off. The text Knock! is sent over the serial link every time the LED is toggled. Let’s prove that this is being received correctly: