This week I made a project with parts from the Arduino Starter Kit. I skipped over building the Proto Shield from the kit, since I made a how-to a while back. Otherwise, it’s a simple build that doesn’t require any soldering.

Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It’s an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board. Arduino is open source!
In addition to the genuine Arduino, resistors, buttons and other goodies, we’ve also tossed in our best selling Making Things Talk book. This starter kit will help get you started quickly without having to source a lot of parts and do a lot of shopping. Check out the “How To” for some helpful links to provide support and contact with the growing Arduino community.

Features

  • Now Shipping With the New Arduino Duemilanove
  • 1x Mini Breadboard
  • 1x 3 ft. USB Cable
  • 10x 1K Resistors
  • 2x 10k Resistors
  • 3x Red LEDs
  • 2x Green LEDs
  • 1X Superbright Blue LED
  • 1x Momentary Tactile Switch
  • 2x Interlink Force Sensing Resistors
  • 1x Protoshield Kit (unassembled)
  • Making Things Talk by Tom Igoe
  • 24″ each of Red, Blue & Black AWG jumper wire
  • 9V Battery Case w/DC Plug (some assembly required)
  • Yes, even a 9V battery

Here is

the code

I used on the Arduino. It’s NOT optimized. Why? Well, I thought this was the best way to write it so a beginner could really understand how it works. Think you can optimize it the best? Let’s see what you got! Post the smallest, most efficient, version in the comments!


Suscribe to the MAKE podcast
| Download for iTunes

/*
--------------------------------------------

Make Magazine - Force Sensor Demo

This simple program visually shows the amount of force placed on the sensor
There are much more efficient ways to program, this way was chosen because
it is very easy to understand.

By Marc de Vinck - Licensed under Creative Commons....whatever.

--------------------------------------------
*/

// Here are the constants that we define prior to the program running

int forcePin = 2; // select the input pin for the force sensor
int val = 0; // variable to store the value coming in from the sensor

int led1=9; // defines "led1" as the number 9
int led2=10; // defines "led2" as the number 10
int led3=11; // defines "led3" as the number 11
int led4=12; // defines "led4" as the number 12
int led5=13; // defines "led5" as the number 13

// End of constant definitions

void setup() //run one time when the Arduino first powers up
{
Serial.begin(9600); //starts serial communication, only used for debgugging

pinMode(led1, OUTPUT); // remeber led1 = pin 9, this statement sets pin 9 to output only
pinMode(led2, OUTPUT); // remeber led2 = pin 10, this statement sets pin 10 to output only
pinMode(led3, OUTPUT); // remeber led3 = pin 11, this statement sets pin 11 to output only
pinMode(led4, OUTPUT); // remeber led4 = pin 12, this statement sets pin 12 to output only
pinMode(led5, OUTPUT); // remeber led5 = pin 13, this statement sets pin 13 to output only
}

void loop() //This next bit of code runs continuously
{

val = analogRead(forcePin); // read the value from the sensor

Serial.println(val,DEC); // print the value "val" of the sensor (used for debugging)

if (val>250){ //if the value is maxed out or greater than 250

// aternative code for the following -----for (i=1; i<6; i=i++); digitalwrite(led[i],HIGH)

digitalWrite(led5,HIGH); // turns on all 5 LEDs
digitalWrite(led4,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led1,HIGH);
delay(100); //slight delay to minimize flickering
}
else{
digitalWrite(led5,LOW); //turn off all 5 LEDs
digitalWrite(led4,LOW);
digitalWrite(led3,LOW);
digitalWrite(led2,LOW);
digitalWrite(led1,LOW);
}

if (val>=175 && val<=250){ //if value is between 100 and 175
digitalWrite(led4,HIGH); //turns on 4 LEDs
digitalWrite(led3,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led1,HIGH);
delay(100); //slight delay to minimize flickering
}
else{
digitalWrite(led4,LOW); //turns off 4 LEDs
digitalWrite(led3,LOW);
digitalWrite(led2,LOW);
digitalWrite(led1,LOW);
}

if (val>=100 && val<=175){ //if value is between 100 and 175
digitalWrite(led3,HIGH); //turns on 3 LEDs
digitalWrite(led2,HIGH);
digitalWrite(led1,HIGH);
delay(100); //slight delay to minimize flickering
}
else{
digitalWrite(led3,LOW); // you get the picture....
digitalWrite(led2,LOW);
digitalWrite(led1,LOW);
}

if (val>=25 && val<=100){
digitalWrite(led2,HIGH);
digitalWrite(led1,HIGH);
delay(100); //slight delay to minimize flickering
}
else{
digitalWrite(led2,LOW);
digitalWrite(led1,LOW);
}
if (val>=0 && val<=25){
digitalWrite(led1,HIGH);
delay(100); //slight delay to minimize flickering
}
else{
digitalWrite(led1,LOW);
}
}

In the Maker Shed:
Makershedsmall

IMG_5817copy.JPG

Arduino Starter Kit

More:

IMG_3111644.JPG

How-to Make a Proto Shield

Marc de Vinck

I’m currently working full time as the Dexter F. Baker Professor of Practice in Creativity in the Masters of Engineering in Technical Entrepreneurship Program at Lehigh University. I’m also an avid product designer, kit maker, author, father, tinkerer, and member of the MAKE Technical Advisory board.


Related
blog comments powered by Disqus

Related Supplies at Maker Shed

Follow

Get every new post delivered to your Inbox.

Join 28,391 other followers