
micro:bit不少學校愛用,入門容易,但想進階應用時就會覺得有些麻煩,這時有一片好用的擴展板就能幫上大忙了!
這塊Keyes的擴展板很特別,把20個PIN分兩排,可以自訂要供3.3V或是5V的電,而且還是每PIN都有獨立供電,接感測器真的很方便呢!
對了!這塊板子連I2C和SPI獨立出來了,要接一些厲害的感測器就輕鬆多了!傑森試用後真的是蠻推的哦。

micro:bit擴展板賣場:https://bre.is/qrf8tcnw

void loop() {
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}