FSR and visualization

Submitted by sebarness on Tue, 02/26/2013 - 01:18


Objective: I have hooked up my FSR to light up a LED and output a visualization graph using Processor. The graph makes higher lines according to amount of force on sensor and captures the time of force on the sensor as well. At the edge of the screen it will go back to the beginning. For my mechanical construction I constructed a hand that you push in order to apply force to the sensor. I thought it would be interesting to create an iconic symbol for my FSR.
Software : Processor
//got hep from Arduino documentation
import processing.serial.*;
// Change this to the portname your Arduino board
String portname = "/dev/tty.usbmodemfd121"; // or "COM5"
Serial port;
int xPos = 1;
void setup(){
  port = new Serial(this, portname, 9600);
void draw() {
void serialEvent (Serial port) {
String inString = port.readStringUntil('\n');  //read serial until new line
if (inString != null) {
float fsr = float(inString);
fsr = map(fsr, 0, 1023, 0, height);  //map instring value
// draw the line:
 line(xPos, height, xPos, height - fsr);
 // at the edge of the screen, go back to the beginning:
 if (xPos >= width) {
 xPos = 0;
 else {
 // increment the horizontal position:
photo (10).JPG
Your rating: None
Drupal theme by Kiwi Themes.