|
CLASS DOCUMENTS
REPORTS & ASSIGNMENTS
CLASS CONTENT
USING THIS SITE
registered authors login here You are: (logout) For more on PMWiki, see pmwiki.org |
Sl 974Assignment 2: dataloggingby Nont I use Flexiforce as a sensor for testing in this datalogging project. And then, I just send raw data from FlexiForce to processing via serial to check the character of the data of this sensor. ![]() Picture 1: ![]() Picture A: When I let the sensor stretch as original form, graph was very smooth (A). ![]() Picture B: When I bent the sensor to the position that suitable for pressing, the data had some noise(B). ![]() Picture C: When I started pressing it, the data was dramatically changed (C). ![]() Picture 2: Form this testing, I found that it was very dificult to estimate giving the same value of force to the sensor again. '+++This is a code for pic+++ ' ' Define ADCIN parameters
DEFINE ADC_BITS 10 ' Set number of bits in result ++This is a code for processing++ /* import processing.serial.*; Serial myPort; // The serial port // initial variables: int i = 1; // counter int inByte = -1; // data from serial port void setup () { // List all the available serial ports
println(Serial.list());
//I use COM4 so I open Serial.List()[1]
myPort = new Serial(this, Serial.list()[1], 9600);
// set inital background:
background(100);
} void draw () { if (myPort.available() > 0) {
inByte = myPort.read();
serialEvent();
}
} void serialEvent () { // draw the line:
stroke(255,255,75);
line(i, height, i, (height - inByte)-20);
// at the edge of the screen, go back to the beginning:
if (i >= width) {
i = 0;
background(100);
}
else {
i++;
}
} |