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 36 | Analog Input | |
Light Sensor(R) | GPIO 39 | Analog Input | |
Botton A | GPIO 35 | Digital Input | |
Botton B | GPIO 27 | Digital Input | |
Temperature Sensor | GPIO 34 | Analog Input | |
Buzzer | GPIO 25 | PWM(Digital Output) / Analog Output | |
RGB_LED | GPIO 4 | Digital Output | |
MPU9250_SCL | GPIO 22 | Digital Output | |
MPU9250_SDA | GPIO 21 | Digital Output | |
MPU9250_INT | GPIO 16 | Digital Input | |
R_LED(SPI_SCK) | GPIO 18 | Digital 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); }
실행 결과
728x90