First Real Arduino Project. FSR, LED and LCD display

Hi,

I’ve been learning Arduino for the past couple of weeks and recently made my first original project. It borrows from Getting Started with Arduino by Banzi and the Arduino tutorial for the LCD.

It measures the pressure on a force sensitive resistor and lights an LED according and displays the amount of pressure (a number between 0 - 255) on the LCD screen.

Here it is:

// Force Sensitive Resistor(FSR) to light LED analogly according to pressure
// and display amount of pressure on an 16*2 LCD screen

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // set pins for LCD
// set global variables
const int LED = 9; // LED connected to pin 9 for analog write
const int FSR = 0; // FSR connected to analog pin 0

int level = 0; // variable for the level of force applied to the FSR

void setup() // run once to setup
{
  pinMode (LED, OUTPUT); // LED set as output
  //analog pins are automatically set to input
  lcd.begin(16,2); // set up LCD number of columns and rows
  lcd.print("Pressure Level:"); // display message on LCD
}
void loop() // repeated routine
 {
   // first, read the pressure level and set brightness of LED
   level = analogRead(FSR)/4; // read level of pressure on the FSR
   // divided by 4 as analog read is 4x sentive as digital write
   analogWrite(LED, level); // set brightness of LED to pressure level
   delay(100); // wait to see the effect
   
   //display pressure level on the LCD screen
   lcd.setCursor(0,1); // set cusor to second line, first spot
   lcd.print(level); // display level of pressure
 }

I understand that it doesn’t have much of a practical purpose, but I was still proud that I was able to put something like this together with little knowledge of micro controllers and programming.

I’ll post a photo soon.

I blogged about it here:
http://joesgizmos.wordpress.com/2012/06/02/project-1-force-sensitive-resistor-led-lcd-display-and-arduino/

Please let me know what you think and if you have any suggestions. Thanks,

Joe

I'll fiddle with projects that may not have much real-world application, but if I learn something, or even have a bit of fun, then I consider that practical! Sounds like maybe you scored on both counts! Nice work, and Welcome!