i also used this orginal code from the project link
i tryed to modify it as wekl , but there is only a small difference , but it is not the expected result after all
//Based on examples from Arduino's Graphing Tutorial and OscP5 documentation
import processing.serial.*;
Serial myPort; // The serial port
int xPos = 1; // horizontal position of the graph
float oldHeartrateHeight = 0; // for storing the previous reading
void setup () {
// set the window size:
size(600, 400);
frameRate(25);
// List available serial ports.
println(Serial.list());
// Setup which serial port to use.
// This line might change for different computers.
myPort = new Serial(this, Serial.list()[1], 9600);
// set inital background:
background(0);
}
void draw () {
}
void serialEvent (Serial myPort) {
// read the string from the serial port.
String inString = myPort.readStringUntil('\n');
if (inString != null) {
// trim off any whitespace:
inString = trim(inString);
// convert to an int
println(inString);
int currentHeartrate = int(inString);
// draw the Heartrate BPM Graph.
float heartrateHeight = map(currentHeartrate, 0, 1023, 0, height);
stroke(0,255,0);
line(xPos - 1, height - oldHeartrateHeight, xPos, height - heartrateHeight);
oldHeartrateHeight = heartrateHeight;
// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
background(0);
} else {
// increment the horizontal position:
xPos++;
yes there is data ranging from approx 30 to 400 , but the confusing thing us the the serial monitor keeps showing data even if i disconnect the input wire to A0 !!!
bro have you seen the project in makezine ?
this what i get everytime i run the code even if nothing is attached to analog input, see the pic plz
the analog input supposed to recieve the pulse signal from the pair ir transmitter and detector
but it seems like nothing is read through the serial monitor !
I'm not your brother (I hope), but I've looked at the project. What I can NOT see is proof that you constructed the device correctly or that you attached it correctly to the Arduino.
this what i get everytime i run the code even if nothing is attached to analog input,
I've said more than once that it makes no sense running the code with nothing connected to the analog input pin. But, if connecting, or not connecting, the device to the analog pin makes no difference, then the problem is NOT in the code on the Arduino OR the code on the PC. It means that the hardware connected to the Arduino is NOT functioning properly.
see the pic plz
The proxy server is refusing connections
Firefox is configured to use a proxy server that is refusing connections.
Check the proxy settings to make sure that they are correct.
Contact your network administrator to make sure the proxy server is working.
I got the error like your
finally, I realized that the broblem is in the usb port, I plugged the usb port of arduino serial to the usb port of the laptop fan. so it makes so much noise. I plugged the usb port of arduino to another usb port of my laptop and it's really good display. (SORRY FOR MY SUPER BAD ENGLISH, I'M VIETNAMESE )