pxt-grove/README.md

57 lines
1.0 KiB
Markdown
Raw Normal View History

2017-06-23 03:54:44 +02:00
# Grove
A Microsoft MakeCode package for for Seeed Studio Grove module.
## Basic usage
2018-01-30 07:31:04 +01:00
### Grove - Gesture
Create gesture events.
2018-01-30 07:40:13 +01:00
2017-06-23 03:54:44 +02:00
```blocks
grove.onGesture(GroveGesture.Up, () => {
2018-01-30 07:51:35 +01:00
basic.showString("Up");
2017-06-23 03:54:44 +02:00
})
grove.onGesture(GroveGesture.Down, () => {
2018-01-30 07:51:35 +01:00
basic.showString("Down");
2017-06-23 03:54:44 +02:00
})
```
2018-01-30 07:31:04 +01:00
### Grove - Ultrasonic Ranger
2017-06-23 03:54:44 +02:00
2018-01-30 07:31:04 +01:00
Measure distance in centimeters, specify the signal pin.
2018-01-30 07:40:13 +01:00
2018-01-30 07:31:04 +01:00
```blocks
2018-01-30 07:51:35 +01:00
let distance = grove.measureInCentimeters(DigitalPin.P0);
2017-06-23 03:54:44 +02:00
```
2018-01-30 07:31:04 +01:00
Measure distance in inches, specify the signal pin.
2018-01-30 07:40:13 +01:00
2017-06-23 03:54:44 +02:00
```blocks
2018-01-30 07:51:35 +01:00
let distance = grove.measureInInches(DigitalPin.P0);
2018-01-30 07:31:04 +01:00
```
2017-06-23 03:54:44 +02:00
2018-01-30 07:31:04 +01:00
### Grove - 4 digital display
2017-06-23 03:54:44 +02:00
2018-01-30 07:31:04 +01:00
Create a 4 Digital Display driver, specify the clk and data pin, and set the brightness level, then start display value.
2018-01-30 07:40:13 +01:00
2018-01-30 07:31:04 +01:00
```blocks
2018-01-30 07:51:35 +01:00
let display = grove.createDisplay(DigitalPin.P0, DigitalPin.P1);
display.set(7);
display.show(1234);
2017-06-23 03:54:44 +02:00
```
2018-01-30 07:31:04 +01:00
Use ``||bit||`` to display one bit number.
2017-06-23 03:54:44 +02:00
2018-01-30 07:31:04 +01:00
Use ``||point||`` to open or close point dispay.
2017-06-23 03:54:44 +02:00
2018-01-30 07:31:04 +01:00
Use ``||clear||`` to clean display.
2017-06-23 03:54:44 +02:00
## License
MIT
## Supported targets
* for PXT/microbit