“(SKU:SEN030120)循迹传感器寻迹传感器智能小车黑白线检测”的版本间的差异
来自YwRobot Studio Wiki
YWrobot WB1(讨论 | 贡献) (创建页面,内容为“循迹传感器寻迹传感器智能小车黑白线检测 <br> ==产品...”) |
YWrobot WM(讨论 | 贡献) |
||
| 第28行: | 第28行: | ||
===样例代码=== | ===样例代码=== | ||
<pre style="color:blue"> | <pre style="color:blue"> | ||
| − | + | int ledPin = 9; | |
| + | int potPin = 2; | ||
| + | void setup() | ||
| + | { | ||
| + | pinMode(ledPin,OUTPUT); | ||
| + | pinMode(potPin,INPUT); | ||
| + | } | ||
| + | |||
| + | void loop(){ | ||
| + | if(digitalRead(potPin)==LOW){ | ||
| + | digitalWrite(ledPin,HIGH); | ||
| + | } | ||
| + | if(digitalRead(potPin)==HIGH){ | ||
| + | digitalWrite(ledPin,LOW); | ||
| + | } | ||
| + | } | ||
</pre> | </pre> | ||
2016年9月12日 (一) 09:52的最新版本
产品参数
- 尺寸:36*10mm
- 固定孔:3mm
- 探头:TCRT5000
- 检测距离:3-12mm
- 检测方式:红外非调制反射检测(注意避开强光)
- 输出信号:5V数字电平(白线高电平,黑线低电平)
- 电压:5V
产品特性
- 红外光检测黑白线,识别度高,性能稳定
- 采用施密特触发方式,反应灵敏,信号质量好
- 每路设有LED指示灯,方便调试
- 适用于各种智能小车的循迹检测试验
使用教程
样例代码
int ledPin = 9;
int potPin = 2;
void setup()
{
pinMode(ledPin,OUTPUT);
pinMode(potPin,INPUT);
}
void loop(){
if(digitalRead(potPin)==LOW){
digitalWrite(ledPin,HIGH);
}
if(digitalRead(potPin)==HIGH){
digitalWrite(ledPin,LOW);
}
}
更多
[YWRobot产品资料下载]