汽车厂自制的流水线边 物料亮灯防错系统

汽车厂自制的流水线边 物料亮灯防错系统_第1张图片
汽车厂自制的流水线边 物料亮灯防错系统_第2张图片
生产线用RFID读卡器读出车辆识别号,在根据物流系统识别出正确的零件型号,最后在零件盒子上亮灯。 会自动根据不同的订单亮不同的信号灯。这是总装维修股自主编程自制的电脑系统。

系统的UNO单片机程序

//低电平 点亮LED
#define Pin2 2
#define Pin3 3
#define Pin4 4
#define Pin5 5
#define Pin6 6
#define Pin7 7
#define Pin8 8
#define Pin9 9
#define Pin10 10
#define Pin11 11
void setup()
{
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(Pin2, OUTPUT) ;
  pinMode(Pin3, OUTPUT) ;
  pinMode(Pin4, OUTPUT) ;
  pinMode(Pin5, OUTPUT) ;
  pinMode(Pin6, OUTPUT) ;
  pinMode(Pin7, OUTPUT) ;
  pinMode(Pin8, OUTPUT) ;
  pinMode(Pin9, OUTPUT) ;
  pinMode(Pin10, OUTPUT) ;
  pinMode(Pin11, OUTPUT) ;
  digitalWrite ( Pin2, HIGH);
  digitalWrite ( Pin3, HIGH);
  digitalWrite ( Pin4, HIGH);
  digitalWrite ( Pin5, HIGH);
  digitalWrite ( Pin6, HIGH);
  digitalWrite ( Pin7, HIGH);
  digitalWrite ( Pin8, HIGH);
  digitalWrite ( Pin9, HIGH);
  digitalWrite ( Pin10, HIGH);
  digitalWrite ( Pin11, HIGH);
}

void loop()
{
  // put your main code here, to run repeatedly:
  if (Serial.available() > 0)
  {
    char ch = Serial.read();
    Serial.print(ch);
    //开灯
    if ( ch == '2')
    {
      digitalWrite ( Pin2, LOW);
      Serial.println("turn on pin2");
    }
    if ( ch == '3')
    {
      digitalWrite ( Pin3, LOW);
      Serial.println("turn on pin3");
    }
    if ( ch == '4')
    {
      digitalWrite ( Pin4, LOW);
      Serial.println("turn on pin4");
    }

    if ( ch == '5')
    {
      digitalWrite ( Pin5, LOW);
      Serial.println("turn on pin5");
    }
    if ( ch == '6')
    {
      digitalWrite ( Pin6, LOW);
      Serial.println("turn on pin6");
    }
    if ( ch == '7')
    {
      digitalWrite ( Pin7, LOW);
      Serial.println("turn on pin7");
    }
    if ( ch == 'a')
    {
      digitalWrite ( Pin8, LOW);
      Serial.println("turn on pin8");
    }
    if ( ch == 'b')
    {
      digitalWrite ( Pin9, LOW);
      Serial.println("turn on pin9");
    }
    if ( ch == 'x')
    {
      digitalWrite ( Pin10, LOW);
      Serial.println("turn on pin10");
    }
    if ( ch == 'y')
    {
      digitalWrite ( Pin11, LOW);
      Serial.println("turn on pin11");
    }
    // 关灯
    if ( ch == 'C')
    {
      digitalWrite ( Pin2, HIGH);
      digitalWrite ( Pin3, HIGH);
      digitalWrite ( Pin4, HIGH);
      digitalWrite ( Pin5, HIGH);
      digitalWrite ( Pin6, HIGH);
      digitalWrite ( Pin7, HIGH);
      digitalWrite ( Pin8, HIGH);
      digitalWrite ( Pin9, HIGH);
      digitalWrite ( Pin10, HIGH);
      digitalWrite ( Pin11, HIGH);
      Serial.println("all turn off");
    }
  }

}

系统通过有人的以太网转串口模块 单片机就可以使用低成本的串口单片机

你可能感兴趣的:(亮灯零件防错,c语言)