강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của robolee0725
robolee0725

câu hỏi đã được viết

Khóa học Arduino

pulseln was not declared in this scope 오류 도와주세요

Viết

·

862

0

안녕하세요 아두이노 1.8.11 베타버젼 사용하고 있읍니다.

1.pulseln 오류  발생 원인

2,아두이노 웹에디타 에서 스케치를 코딩하면 영문 이 한글로 바뀌면서

    이상하게 번역을 하는데 그냥 영문 코딩이 되게 하는방법

    알려주심 감사 하겠읍니다.

#define TRIG_PIN 2

#define ECHO_PIN 3

#define COLOR_COUNT 10

#define GAP 10

#define RED 11

#define GREEN 10

#define BLUE 9

int colors [COLOR_COUNT][3] =

{

  {255, 0, 0}, 

  {255, 255, 0},

  {128, 255, 0},

  {0, 255, 0},

  {0, 255, 128},

  {0, 128, 255},

  {0, 0, 255},

  {0, 255, 255},

  {127, 0, 255},

  {255, 0, 255},

};

void setup() {

  // put your setup code here, to run once:

  pinMode(TRIG_PIN, OUTPUT);

  pinMode(ECHO_PIN, INPUT);

}

void loop() {

  // put your main code here, to run repeatedly:

  

  digitalWrite(TRIG_PIN, LOW);

  delayMicroseconds(2);

  digitalWrite(TRIG_PIN, HIGH);

  delayMicroseconds(5);

  digitalWrite(TRIG_PIN, LOW);

long distance = pulseln(ECHO_PIN,HIGH,5800)/58;

  if (0<distance && distance <= COLOR_COUNT * GAP){

  for (int i= 0; i < COLOR_COUNT; i++){

    if (i * GAP < distance && distance <= (i + 1) * GAP) {

      analogWrite(RED, colors[i][0]);

      analogWrite(GREEN, colors[i][1]);

      analogWrite(BLUE, colors[i][2]);

      break;

    }

  }

} else {

  analogWrite(RED, 0);

    analogWrite(GREEN, 0);

    analogWrite(BLUE, 0);

  }

}

arduino

Câu trả lời

Câu hỏi này đang chờ câu trả lời
Hãy là người đầu tiên trả lời!
Hình ảnh hồ sơ của robolee0725
robolee0725

câu hỏi đã được viết

Đặt câu hỏi