Hey all!
So I'm stumped with this, I'm currently learning the basics of using an arduino, more specifically the Serial and UART communication.
I've setup a 9600 baudrate, and made a loop to try and have a sampling frequency of an analogue signal of 1kHz. So in my head each milisecond, the analogue value goes through the ADC, is stored, and then a message is printed on the Serial Monitor . The message I'm printing is 25 characters long so i'm thinking it should be 250 bits per message, and since the loop should take a bit more than 1 ms in reality, I would be sending something like 250000 bits per second to the Serial Monitor on my PC. With a 9600 baudrate I should be losing the most part of this information I thought, but the serial monitor is showing almost all of it, with only one or two entries missing, and I dont get why. I used the code below and a Seeeduino Xiao.
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
analogReadResolution(12);
}
// the loop routine runs over and over again forever:
void loop() {
int time = millis()
// read the input on analog pin 0:
float sensorValue = analogRead(A0);
// print out the value you read:
Serial.print("Time:")
Serial.print(time)
Serial.print(" Value:")
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}