#先上电,再点击 “开始执行”;
tclear
after 3000
msend "12345" "xxxx:"
after 2300
tsend "xxxxx"
after 1000
tsend "run xxxx"
after 32000
msend "12345" "/ #"
after 3000
tsend "Haha2~~"
after 3000
tsend "mount /dev/xxx /xxxx/"
after 2000
tsend "cp /usb/xxxx/xx.img /flash/certified/xx.img"
after 59000
tsend "umount /usb/"
after 900
tsend "umount /flash"
after 29000
tsend "reboot"
说明:
1).msend "12345" "xxxxx:"
向串口输入12345,然后等串口回显“xxxxx:”后,再进行下面的指令,否则一直等待“xxxxx:”.
参考:https://wenku.baidu.com/view/9e30b955f6ec4afe04a1b0717fd5360cbb1a8d5c.html
参考:https://wenku.baidu.com/view/beb4726225c52cc58bd6bed0.html
lesson9 :for循环的学习
for {puts "Start"; set i 0} {$i < 2} {incr i; puts "I after incr: $i"; } {
puts "I inside first loop: $i"
}
//和c一样 有三个条件
;# Because the test is evaluated before the body,
;# this loop won't execute the body of the code.
for {puts "Start"; set i 3} {$i < 2} {incr i; puts "I after incr: $i"; } {
puts "I inside second loop: $i"
}
//不符合条件 直接结束For循环
;# A while loop equivalent to the first for loop:
puts "Start"; set i 0;
while {$i < 2} {
puts "I inside first loop: $i"
incr i;
puts "I after incr: $i";
}
//while 中的 incr用法
==两种for循环的写法
for {set i 0} {$i<=10} {incr i} {#i默认增量是1,即等价incr i 1。注意这个反括号一定要写在这行行末:args: should be "for start test next command"
............
.............}
Q:能不能改为i为我指定的几个数就好。比如我指定i为 3 5 6 7 9这几个数? 谢谢。
foreach i { 1 3 5 7 9 } {
puts "$i"
}
参考:https://blog.csdn.net/wjciayf/article/details/54408819
if else、switch、数组/列表的遍历、子程序/函数的定义和调用、文件的读写等基本语法使用