Can someone explain this to me.
I am really noob in programming but I want to learn, btw I can understand some of the codes but a bit confuse.
This is for our project pulse oximeter. Using a
Nellcor MAX-A Nellcor MAX-A Adult Adhesive Disposable Sensor (24 per case)
where the output of the pulse oximeter is inputed in the arduino decimila.
Another question: How can I change its Aref to higher voltage? just to light a LED.
Thanks in advance!
Its really quite simple to change the AREF of the Arduino (I assume that that's what you're talking about, if not sorry :~). Put whatever voltage you want the AREF to be into the AREF pin of the Arduino.
// declare a couple of floating point variables (double float).
// Static variables are not destoyed between calls to loop() and will be remembered for the next time
static double oldValue = 0;
static double oldChange = 0;
// declare an integer variable and initialise it witrh a value read from the sensor (0 to 1023)
int rawValue = analogRead(sensorPin);
// declare a floating point variable and do some sort of conversion from the raw sensor input to a value
// this calculaton means something to you if you know what sensor you are using
double value = alpha * oldValue + (1-alpha)*rawValue;
// Write a 0 or 1 to the digital output ledPin. The value written is a boolean that works out to false(0) if change and OldChange don't meet the conditions, and true (>0) if they do. This can be confusing until you get used to it.
digitalWrite(ledPin,(change<0.0 && oldChange >0.0));
Serial.println(value);
// save the values in variable that remain (persist) for the next time that loop is called
oldValue= value;
oldChange =change;
// wait a while and then do it all over again
delay(period);
Moderator edit : Code tags added.
I think there is a mistake in this code as change is never set in the code but is assigned to oldChange. After the first time through both change and oldChange will be 0.0.
Put whatever voltage you want the AREF to be into the AREF pin of the Arduino.
...as the long as it is less than or equal to the supply voltage.
So long as it is between 1.0V and the supply voltage, is a low-impedance source and provided you call analogReference(EXTERNAL) in your setup() before any calls to analogRead().
Hi,
the following line is a low pass digital filter: it smooths the analog input value by cutting the
high frequencies, "alpha" is the time constant of the filter.
// declare a floating point variable and do some sort of conversrion from the raw sensor input to a value
// this calculaton means something to you if you know what sensor you are using
double value = alpha * oldValue + (1-alpha)*rawValue;