马上注册 登录
中文乐高 返回首页

zhshshyang的个人空间 https://bbs.cmnxt.com/?61499 [收藏] [复制] [分享] [RSS]

日志

Robotc中如何使用触碰传感器

已有 961 次阅读2018-7-7 05:25

代码讲解: task main() { 
   while(SensorValue(touchSensor) == 0)   //当触碰传感器的值为0,即没有被触碰的情况,就一直循环 
      motor[motorA] = 100;                //马达A全速前进
      motor[motorB] = 100;                //马达B全速前进   
 } 
motor[motorA] = -75;                   /马达A以75的功率后退
motor[motorB] = -75;                   //马达B以75的功率后退 
wait1Msec(1000);                       //等待1000毫秒(1秒)后结束


路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 马上注册

手机版|中文乐高 ( 桂ICP备13001575号-7 )

GMT+8, 2026-4-14 09:25 , Processed in 0.163830 second(s), 17 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

返回顶部