超声波测距毕设单机版本-张怡君

OK,今天讲一个简单的毕设

实验现象



  if (uS / US_ROUNDTRIP_CM <= 30 && uS / US_ROUNDTRIP_CM >= 15)
  {
    digitalWrite(Green, HIGH);
    digitalWrite(Yello, LOW);
    digitalWrite(Red, LOW);

    for (int i = 19; i < 21; i++) {
      display.drawBitmap((i - 16) * 16, 32, cn_allArray[i], 16, 16, 1);
      delay(300);
    }
  }
  if ((uS / US_ROUNDTRIP_CM > 30 && uS / US_ROUNDTRIP_CM < 40) || (uS / US_ROUNDTRIP_CM > 10 && uS / US_ROUNDTRIP_CM < 15))
  {
    digitalWrite(Green, LOW);
    digitalWrite(Yello, HIGH);
    digitalWrite(Red, LOW);

  
    for (int i = 19; i < 21; i++) {
      display.drawBitmap((i - 16) * 16, 32, cn_allArray[i + 4], 16, 16, 1);
      delay(300);
    }
  }
  if (uS / US_ROUNDTRIP_CM <= 10 || uS / US_ROUNDTRIP_CM >= 40)
  {
    digitalWrite(Green, LOW);
    digitalWrite(Yello, LOW);
    di

你可能感兴趣的:(Arduino开发板实验,arduino,超声波传感器,oled显示)