I was trying to evaluate the speed of communication between pc and Arduino, using this code in Arduino:
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println("Ciao Arduino");
}
and this in Python:
import time, serial
arduino = serial.Serial('/dev/cu.usbmodem1421', 250000)
time.sleep(3)
count = 0
start = time.time()
while True:
a = arduino.readline()
print a
count = count+1
time1 = time.time()
if time1-start >1 :
print "--" + str(count)
print a
count = 0
start=time1
Wich print out how many readline() he managed to do to evaluate the speed in further project. And I realized two things:
- The program is working even with different baudrate
- and with correct baudrate(For ex. 300-300 or 250000-25000) the baudrate is irrelevant(and wrong), I mean the 300 baudrate makes 20000 readline() and the 250000 make 5000 of them.
What's the problem? thank you