Reduce delay when Serial communicate between Arduino and Python -


while communicate between arduino , python using serial communication, python program need wait second or more fallowing code:

import serial ser   prt = ser.serial( port='com18', baudrate=9600, parity=ser.parity_none, stopbits=ser.stopbits_one, bytesize=ser.eightbits )   while 1:     prt.write(str(0) + '\r\n')     time.sleep(1) #i want reduce time     prt.write(str(1) + '\r\n')     time.sleep(1) 

this code has sleep(1). stuck python program 1 second.i want remove or reduce time.i tried 0.9,arduino not responding correctly.

this arduino program:

#define led 13  void setup() {   serial.begin(9600);   pinmode(led, output);  }  void loop() { byte incomingbyte;  if (serial.available() > 0) {   incomingbyte = serial.read();   switch (incomingbyte) {     case '1':       digitalwrite(led, high);       break;     case '0':       digitalwrite(led, low);       break;     }    }    } 

how can reduce or remove delay? why need delay(more 1 second) after every sending?


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -