Skip to content
elecfreaksPublic

About

(花瓣)ELECFREAKS Co., Ltd. The "Petal" sensor series for micro:bit, featuring HY2.0 ports. This versatile series combines affordability with effortless usability and a touch of creativity, making it an ideal choice for both beginners and tech enthusiasts.petail sensors

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

204 Commits

Folders and files

Repository files navigation

Petal Extension

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.

Key Features

  • Color Recognition System: An intuitive system using color-coded terminals simplifies sensor and port connections.

Getting Started

Installing the Extension

  1. Launch MakeCode editor and click the "Extensions" icon.
  2. Search for "Petal" or paste the link "https://github.com/elecfreaks/pxt-petal" to download and install the extension.

Basic Examples

Block Editor Example

  1. Drag the "forever" block into the script area.
  2. Inside it, insert a "if...else..." logic control block.
  3. In the condition part, insert the "Petal - buttonRead" block.
  4. If the button is pressed, make the micro:bit display the pattern "Yes", otherwise display the pattern "No".

JavaScript Example

  1. Digital group example.
     basic.forever(function () {
         if (petal.buttonRead(petal.DigitalPort.J1)) {
             basic.showIcon(IconNames.Yes)
         } else {
             basic.showIcon(IconNames.No)
         }
     })
  2. Analog group example.
     basic.forever(function () {
         if (petal.trimpotRead(petal.AnalogPort.J1) > 500) {
             basic.showIcon(IconNames.Yes)
         } else {
             basic.showIcon(IconNames.No)
         }
     })
  3. IIC group example.
     basic.forever(function () {
         if (petal.digitalLightRead() > 500) {
             basic.showIcon(IconNames.Yes)
         } else {
             basic.showIcon(IconNames.No)
         }
     })

Advanced Applications

Explore advanced features such as in-depth sensor data retrieval. For detailed examples and explanations, please visit our online tutorials.

Supported Targets

  • PXT/micro:bit

License

This extension is licensed under the MIT License.

About

(花瓣)ELECFREAKS Co., Ltd. The "Petal" sensor series for micro:bit, featuring HY2.0 ports. This versatile series combines affordability with effortless usability and a touch of creativity, making it an ideal choice for both beginners and tech enthusiasts.petail sensors

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages