设备控制
Posted 西北逍遥
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了设备控制相关的知识,希望对你有一定的参考价值。
int point_id2 = 2; int point_id3 = 3; int point_id4 = 4; int point_id5 = 5; int point_id8 = 8; int point_id9 = 9; int point_id10 = 10; int point_id11 = 11; void setup() // put your setup code here, to run once: Serial.begin(9600); pinMode(point_id2,OUTPUT); pinMode(point_id3,OUTPUT); pinMode(point_id4,OUTPUT); pinMode(point_id5,OUTPUT); pinMode(point_id8,OUTPUT); pinMode(point_id9,OUTPUT); pinMode(point_id10,OUTPUT); pinMode(point_id11,OUTPUT); digitalWrite(point_id2,LOW); digitalWrite(point_id3,LOW); digitalWrite(point_id4,HIGH); digitalWrite(point_id5,HIGH); digitalWrite(point_id8,HIGH); digitalWrite(point_id9,LOW); digitalWrite(point_id10,LOW); digitalWrite(point_id11,LOW); void loop() // put your main code here, to run repeatedly: if(Serial.available()) char r_data = Serial.read(); //A 停止后退 if(r_data==\'A\') digitalWrite(point_id2,LOW); //B 后退 if(r_data==\'B\') digitalWrite(point_id2,HIGH); //C 停止前进 if(r_data==\'C\') digitalWrite(point_id3,LOW); //D 前进 if(r_data==\'D\') digitalWrite(point_id3,HIGH); //E 向右旋转 if(r_data==\'E\') digitalWrite(point_id4,LOW); //F 停止向右旋转 if(r_data==\'F\') digitalWrite(point_id4,HIGH); //G 向左旋转 if(r_data==\'G\') digitalWrite(point_id5,LOW); //H 停止向左旋转 if(r_data==\'H\') digitalWrite(point_id5,HIGH); //吊臂升降 L I 抬升 | K I 放下 | J 停止 if(r_data==\'I\') digitalWrite(point_id8,LOW); if(r_data==\'J\') digitalWrite(point_id8,HIGH); if(r_data==\'K\') digitalWrite(point_id9,LOW); if(r_data==\'L\') digitalWrite(point_id9,HIGH); //吊臂伸缩 N P 伸长 | M P 收缩 | O 停止 if(r_data==\'M\') digitalWrite(point_id10,LOW); if(r_data==\'N\') digitalWrite(point_id10,HIGH); if(r_data==\'O\') digitalWrite(point_id11,LOW); if(r_data==\'P\') digitalWrite(point_id11,HIGH);
##########################
QQ 3087438119
以上是关于设备控制的主要内容,如果未能解决你的问题,请参考以下文章