B4R Question pause loop every 'n' counts

Mostez

Well-Known Member
Licensed User
Longtime User
Hello,
I have this loop, which sends data from SD card to serial stream, I would like to pause the loop for about 100 ms - every 10 K bytes of data(at 10 K, 20 ,30K etc..), to let the other device clear the buffer before receiving next 10 K. any ideas.

Thanks

B4X:
Do While counter < size
            Dim read As Int =  SD.Stream.ReadBytes(Buffer, 0, Min(Buffer.Length, size - counter))
            If read = 0 Then
                success = False
                Exit
            End If
            counter = counter + read
            ' I Want to pause the loop 100ms here every 10k, before sending data 

            StreamSource.Write2(Buffer,0,read)
Loop
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…