This extension is designed to program and drive the sensor series Petal (Flower Petal) micro:bit expansion sensors. To purchase the Petal, visit the Elecfreaks Official Store.
- Color Recognition System: An intuitive system using color-coded terminals simplifies sensor and port connections.
- Launch MakeCode editor and click the "Extensions" icon.
- Search for "Petal" or paste the link "https://github.com/elecfreaks/pxt-petal" to download and install the extension.
Block Editor Example
- Drag the "forever" block into the script area.
- Inside it, insert a "if...else..." logic control block.
- In the condition part, insert the "Petal - buttonRead" block.
- If the button is pressed, make the micro:bit display the pattern "Yes", otherwise display the pattern "No".
JavaScript Example
- Digital group example.
basic.forever(function () { if (petal.buttonRead(petal.DigitalPort.J1)) { basic.showIcon(IconNames.Yes) } else { basic.showIcon(IconNames.No) } })
- Analog group example.
basic.forever(function () { if (petal.trimpotRead(petal.AnalogPort.J1) > 500) { basic.showIcon(IconNames.Yes) } else { basic.showIcon(IconNames.No) } })
- IIC group example.
basic.forever(function () { if (petal.digitalLightRead() > 500) { basic.showIcon(IconNames.Yes) } else { basic.showIcon(IconNames.No) } })
Explore advanced features such as in-depth sensor data retrieval. For detailed examples and explanations, please visit our online tutorials.
- PXT/micro:bit
This extension is licensed under the MIT License.