정보나눔

오픈소스하드웨어 프로젝트에 대한 다양한 정보를 나누는 공간입니다.

read a rotary encoder with interrupts를 업로드하는데 아래와 같이 라이브러리가 잘못되었다는 메세지가 뜨네요
이수인 | 2016-09-29

아두이노 홈페이지에서 다운 받아 read a rotary encoder with interrupts를 업로드하는데 아래와 같이 라이브러리가 잘못되었다는 메세지가 뜨네요?

추가되어 잘못되어 경고 메세지가 뜨는 라이브러리를 삭제하는 방법을 알려주십시요

/* read a rotary encoder with interrupts
   Encoder hooked up with common to GROUND,
   encoder0PinA to pin 2, encoder0PinB to pin 4 (or pin 3 see below)
   it doesn't matter which encoder pin you use for A or B 

   uses Arduino pullups on A & B channel outputs
   turning on the pullups saves having to hook up resistors
   to the A & B channel outputs

*/

#define encoder0PinA  3
#define encoder0PinB  4

volatile unsigned int encoder0Pos = 0;

void setup() {


  pinMode(encoder0PinA, INPUT);
  digitalWrite(encoder0PinA, HIGH);       // turn on pullup resistor
  pinMode(encoder0PinB, INPUT);
  digitalWrite(encoder0PinB, HIGH);       // turn on pullup resistor

  attachInterrupt(0, doEncoder, CHANGE);  // encoder pin on interrupt 0 - pin 2
  Serial.begin (9600);
  Serial.println("start");                // a personal quirk

}

void loop(){
// do some stuff here - the joy of interrupts is that they take care of themselves
}

void doEncoder() {
  /* If pinA and pinB are both high or both low, it is spinning
   * forward. If they're different, it's going backward.
   *
   * For more information on speeding up this process, see
   * [Reference/PortManipulation], specifically the PIND register.
   */
  if (digitalRead(encoder0PinA) == digitalRead(encoder0PinB)) {
    encoder0Pos++;
  } else {
    encoder0Pos--;
  }

  Serial.println (encoder0Pos, DEC);
}

/* See this expanded function to get a better understanding of the
 * meanings of the four possible (pinA, pinB) value pairs:
 */
void doEncoder_Expanded(){
  if (digitalRead(encoder0PinA) == HIGH) {   // found a low-to-high on channel A
    if (digitalRead(encoder0PinB) == LOW) {  // check channel B to see which way
                                             // encoder is turning
      encoder0Pos = encoder0Pos - 1;         // CCW
    }
    else {
      encoder0Pos = encoder0Pos + 1;         // CW
    }
  }
  else                                        // found a high-to-low on channel A
  {
    if (digitalRead(encoder0PinB) == LOW) {   // check channel B to see which way
                                              // encoder is turning 
      encoder0Pos = encoder0Pos + 1;          // CW
    }
    else {
      encoder0Pos = encoder0Pos - 1;          // CCW
    }

  }
  Serial.println (encoder0Pos, DEC);          // debug - remember to comment out
                                              // before final program run
  // you don't want serial slowing down your program if not needed
}

/*  to read the other two transitions - just use another attachInterrupt()
in the setup and duplicate the doEncoder function into say,
doEncoderA and doEncoderB.
You also need to move the other encoder wire over to pin 3 (interrupt 1).
*/

경고: 'Adafruit WS2801 Library' 라이브러리에 .github 허위 폴더

스케치는 프로그램 저장 공간 2,846 바이트(8%)를 사용. 최대 32,256 바이트.
전역 변수는 동적 메모리 212바이트(10%)를 사용, 1,836바이트의 지역변수가 남음.  최대는 2,048 바이트.
잘못된 라이브러리가 C:\Program Files (x86)\Arduino\libraries\Adafruit-WS2801-Library-master에서 발견: C:\Program Files (x86)\Arduino\libraries\Adafruit-WS2801-Library-master
잘못된 라이브러리가 C:\Program Files (x86)\Arduino\libraries\MsTimer2에서 발견: C:\Program Files (x86)\Arduino\libraries\MsTimer2
잘못된 라이브러리가 C:\Program Files (x86)\Arduino\libraries\Adafruit-WS2801-Library-master에서 발견: C:\Program Files (x86)\Arduino\libraries\Adafruit-WS2801-Library-master
잘못된 라이브러리가 C:\Program Files (x86)\Arduino\libraries\MsTimer2에서 발견: C:\Program Files (x86)\Arduino\libraries\MsTimer2

 

 

이전글   |    주석 달아서 다시 올렸습니다 2016-09-29
다음글   |    날씨 정보를 루프문으로 돌리고 싶은데 어렵네요... 2016-09-30