IPOP下的tcl脚本使用

#先上电,再点击  “开始执行”; 
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

参考:https://blog.csdn.net/qq_41661593/article/details/104018467?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param

if else、switch、数组/列表的遍历、子程序/函数的定义和调用、文件的读写等基本语法使用

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值