Documente Academic
Documente Profesional
Documente Cultură
Living
Outside
Play
Technology
Workshop
Table of Contents
FunShield, an Arduino Educational Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
Image Notes
1. Photo cell (no polarity)
2. Diode, observe polarity (black band).
Image Notes
1. Optional I2C headers for connecting to other boards or I2C devices.
Image Notes
1. Shift Register IC. Observe orientation (notch in center on left side.)
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
Image Notes
1. TMP36 temperature sensor
2. NPN transistor. Check the parts data sheet and the schematic to determine the
correct orientation. It varies by manufacture!
Image Notes
1. Check the part's data sheet to determine the correct orientation. It varies by
manufactures!
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
Image Notes
1. SparkFun style piezo has leads aligned horizontally, and has polarity (check
marking on bottom of speaker.)
Image Notes
1. Adafruit style piezo. Leads are aligned vertically and have no polarity.
Image Notes
1. Observe polarity. Long lead is positive, flat side of face is negative (shown
facing downward here).
Image Notes
1. RGB LED. Should be "common cathode" type unless you modify the
connections on the underside of the board.
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
Image Notes
1. For a "Common Anode" RGB, cut the "CC" pad as shown, and bridge the
"CA" pad with solder.
Image Notes
1. Potentiometer or "Trim Pot"
Image Notes
1. These inexpensive trim pots can be used as well.
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
Image Notes
1. Male header to hold alignment while soldering.
2. 2-pin female header for motor.
3. 2-pin female header for analog input like flex sensor.
Image Notes
1. 3-pin male header for servo.
Image Notes
1. Arduino board holds these headers in alignment for soldering.
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
If you haven't downloaded the zip file from: https://github.com/MakersBox/FunShield/archive/master.zip in the previous step, do so now and unzip it.
Move the toolsfolder to your sketchbook folder.
Move the ArduBlockExamples folder to your sketchbook folder.
Restart the Arduino IDE.
Start ArduBlock from [Tools] -> [ArduBlock].
If the "ArduBlock" option is not visible, go back and check you got it in the right location.
The actual directory structure should end up looking like: ../sketchbook/tools/ArduBlockTool/tool/ardublock-FunShield.jar
If you are still having trouble, check out the more detailed instructions at http://blog.ardublock.com/engetting-started-ardublockzhardublock/
6. Open an example project (you will have to navigate to the ../sketchbook/ArduBlockExamples folder.
Since the FunShield library handles all the setup, the setup() function can be empty. I usually ad some code to see what is going on via the console:
void setup() {
Serial.begin(9600);
// Setup serial communications for troubleshooting
Serial.println("FS_01_LED.ino");
}
You should recognize this as the basic Arduino "blink" sketch, just using the FunShield LED() function instead of digitalWrite().
Lets bring in a for loop so we can turn all the LEDs on and off.
void loop(){
for(led=0; led<8; led++){
LED(led, HIGH); // turn LED on
delay(delayTime);
LED(led, LOW); // turn LED off
}
}
You may want to lower your delayTime value so it doesn't take a full 8 seconds to traverse the LEDs.
Now, how could we get the LED to reverse direction when it reaches the end? Another for loop maybe?
void loop(){
for(led=0; led<8; led++){
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
Notice I start back on led #6 because led #7 was already lit by the first for loop. I also stop the second loop at led#1 because the other for loop handles it as well.
What if we want to add an audible clue as the light changes direction? Here is where the beauty of the library comes in handy. No need to look up pin numbers. Just call
the speaker() function
void loop(){
for(led=0; led<8; led++){
LED(led, HIGH); // turn LED on
delay(delayTime);
LED(led, LOW); // turn LED off
}
speaker(440, 10); // short beep
for(led=6; led>0; led--){
LED(led, HIGH); // turn LED on
delay(delayTime);
LED(led, LOW); // turn LED off
}
speaker(880, 10); // short beep
}
One final trick to throw in. How about we vary the speed of the LED based on the trim potentiometer value? Piece of cake! Just change the delayTime variable to the
trim() function:
void loop(){
for(led=0; led<8;
LED(led, HIGH);
delay(trim());
LED(led, LOW);
}
speaker(440, 10);
for(led=6; led>0;
LED(led, HIGH);
delay(trim());
LED(led, LOW);
}
speaker(880, 10);
}
led++){
// turn LED on
// read potentiometer to determine delay time.
// turn LED off
// short beep
led--){
// turn LED on
// turn LED off
// short beep
Wow, that was easy! You have the basis for a cool 2-dimension Pong game. Now go forth and have FUN!
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/
Related Instructables
Linux, WiFi,
Ethernet , USB
Shield for
Arduino by
edwin chen
Controlling an
LED with
arduino and
Wifly shield by
yhtomitsy
Run Ethernet
shield on
arduino by
Linksprite
Make Amarino
evaluation
shield for
AndroidArduinoBluetooth
Experiments by
buildcircuit
The Arduino
DoAnything
Shield by
blinkyblinky
How to tweet
from an Arduino
using the wifi
sheild by
echoalex
Advertisements
Comments
2 comments
Add Comment
YdnaW says:
I'm getting 'fun shield does not name a type' when uploading to the arduino. Am I missing some header files? thanks
MakersBox says:
Step 11 shows you how to install the FunShield library.
Once the library is installed, in your sketch you use the following to access the FunShield functions:
// sets up and initialize FunShield
#include
#include // Require for I2C communication
FunShield fs; // Instanciate FunShield instance
Let me know how it goes!
http://www.instructables.com/id/FunShield-an-Arduino-Educational-Platform/