Hey, I'm new to arduino.
I would like to know how you determine the sample frequency of your analog data.I want to analyze the data further in Matlab, but I should know the sample frequency.
My script goes as follow:
int sensorPin = 0
int val = 0;
void setup() {Serial.begin(9600);
// put your setup code here, to run once:
}
void loop() {
val = analogRead(sensorPin);
// put your main code here, to run repeatedly:,
Serial.println(val);
delay(20);
}
To my understanding the delay(20) command sends a signal after 20 ms therefore corresponding to the sampling interval, thus the sample frequency should be 1/0.02= 50 Hz.
I get confused with baud rate (9600),does it affect the sample frequency?