vb.net - Serial read value does not change -
i trying read serial data arduino sending keeps giving me on , on first string receives if change arduino output. why give me first value , not update?
module module1 sub main() dim com4 io.ports.serialport = nothing com4 = my.computer.ports.openserialport("com4") dim incoming string incoming = com4.readline() console.writeline(incoming) threading.thread.sleep(250) loop end sub end module
it be, depending on arduino sketch, sends same data out time, filling receive buffer, gets read time in loop.
try using events
dim withevents com4 serialport....... sub datareceivedhandler (sender object, e eventargs) handles com4.datareceived dim incoming string = com4.readline console.writeline(incoming) end sub
Comments
Post a Comment