티스토리 뷰

OS/Banana Pi /BPI-Bit

BPI-Bit : AB 버튼 입력 받기

파란크리스마스 2019. 2. 5. 23:52
728x90

출처

BPI-Bit : AB 버튼 입력 받기

BPI-Bit에는 두개의 버튼이 있습니다. 특이한 점은 버튼이 눌러진 경우 0, 그렇지 않은 경우 1을 반환 하고 있습니다.(저는 반대의 경우라고 생각했지만...)

GPIO control of BPI:bit

GPIO control of BPI:bit
Light Sensor(L)GPIO 36Analog Input
Light Sensor(R)GPIO 39Analog Input
Botton AGPIO 35Digital Input
Botton BGPIO 27Digital Input
Temperature SensorGPIO 34Analog Input
BuzzerGPIO 25PWM(Digital Output) / Analog Output
RGB_LEDGPIO 4Digital Output
MPU9250_SCLGPIO 22Digital Output
MPU9250_SDAGPIO 21Digital Output
MPU9250_INTGPIO 16Digital Input
R_LED(SPI_SCK)GPIO 18Digital Output

예제 소스

//buttom config
#define BottonA 35
#define BottonB 27

void setup() {
  Serial.begin(115200); //Serial Port Config 115200-8-N-1
  pinMode(BottonA, INPUT);//Botton B Pin Mode :Digital Input
  pinMode(BottonB, INPUT);//Botton B Pin Mode :Digital Input
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.printf("BottonA = %d / BottonB = %d \n", digitalRead(BottonA), digitalRead(BottonB));  
  delay(500);
}

실행 결과

댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함