1.GPIO port
Operate the GPIO port of BiBoard
There is no separate GPIO port on BiBoard, but the multiplexed serial port 2 (pin 16, 17) or the PWM pin of the unused PWM servo interface can be used as GPIO port. The GPIO port is also relatively simple to use. After configuring the input and output mode, the usage is exactly the same as that of Arduino UNO. You can use any IO control program of Arduino UNO, just change the number of IO .
/* In this demo, we use TX2, RX2 as general purpose IO
* TX2 : IO17
* RX2 : IO16
*/
void setup() {
// initialize digital pin 16 & 17 as an output.
pinMode(16, OUTPUT);
pinMode(17, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(16, HIGH); // GPIO 16 & 17 HIGH
digitalWrite(17, HIGH);
delay(1000); // wait for a second
digitalWrite(16, LOW); // GPIO 16 & 17 LOW
digitalWrite(17, LOW);
delay(1000); // wait for a second
}
Last modified 2yr ago