to do this week assignment I made new input board because it is really hard to read synchronous detecting sensor and adxl343 sensor with arduino ide.
It because I have no background with c code.
So I try to use loader and made touch sensor which has a lot of tutorials.
I cut the board also the touch sensor. with fr1 board. Isn't it pretty?
Here is the code that I use for this project.
Use Arduino serial and Processing.
I used load and make the square color has change.
Here is the code that I use _ in processing
import processing.serial.*;
int i;
Serial myPort;
float data;
public static int ON = 1;
public static int OFF = 0;
void setup() {
size (1200, 800); // set resolution
delay(3000); // make delay for communication well
String portName = Serial.list()[3]; //select serial port in the Serial list println(Serial.list());
myPort = new Serial(this, portName, 1200); //watch out the number it has to match with yours.
}
void draw() {
background(255); //background color - write
rect(600,400,200,100); //make rectangle
fill(0,data/4,data/5); //the color inside of the rectangle going to change
}
void serialEvent(Serial p) {
String message = myPort.readStringUntil(10); //
if (message != null) //when there is a data,
{
print("Received: "); //print the data
println(message);
data = float(message); //save the data
}
}
Here is the result! voila!!
Here is the link for Processing. about rectangle
HOME