Need help on how to get data from ultrasonic sensor by using virtual pin

Your Uno isn’t able to consistently read and write dat to a SoftwareSerial port at this speed, it just doesn’t have the processing power to emulate a serial port with this baud rate. You should read this…

Pete.