I want to save 6 variables incoming over a serial port. These variables are transmitted one after another in one line. This line is sent repeatedly every second in order to update the variables.
The code works correctly, but only for the first line. Afterwards I get the message "invalid command name "ChME3"", where "ChME3" is the first variable in the line.
What's wrong with my code?
The code works correctly, but only for the first line. Afterwards I get the message "invalid command name "ChME3"", where "ChME3" is the first variable in the line.
What's wrong with my code?
Code:
set data {}
set LIST {}
set var0 {}
set var1 {}
set var2 {}
set var3 {}
set var4 {}
set var5 {}
set chan [open com5 r]
fconfigure $chan -mode "9600,n,8,1" -blocking 1 -buffering none -translation binary
fileevent $chan readable [set data [gets $chan]]
set LIST [concat {*}[split $data]] ;
lassign $LIST var0 var1 var2 var3 var4 var5
puts "data: $data"
puts "LIST: $LIST"
puts "var0: $var0"
puts "var1: $var1"
puts "var2: $var2"
puts "var3: $var3"
puts "var4: $var4"
puts "var5: $var5"