Modify readme.md

This commit is contained in:
jinyuan.weng 2018-01-30 14:31:04 +08:00
parent c89dd93df8
commit 644bc64e23

View File

@ -4,53 +4,51 @@ A Microsoft MakeCode package for for Seeed Studio Grove module.
## Basic usage ## Basic usage
Grove - Gesture ### Grove - Gesture
Create gesture events.
```blocks ```blocks
// Create gesture events
grove.onGesture(GroveGesture.Up, () => { grove.onGesture(GroveGesture.Up, () => {
basic.showString("Up") basic.showString("Up")
}) })
grove.onGesture(GroveGesture.Down, () => { grove.onGesture(GroveGesture.Down, () => {
basic.showString("Down") basic.showString("Down")
}) })
``` ```
Grove - Ultrasonic Ranger ### Grove - Ultrasonic Ranger
```blocks
// Measure distance in centimeters, specify the signal pin
let distance = grove.measureInCentimeters(DigitalPin.P0);
// Measure distance in inches, specify the signal pin Measure distance in centimeters, specify the signal pin.
let distance = grove.measureInInches(DigitalPin.P0); ```blocks
let distance = 0
distance = grove.measureInCentimeters(DigitalPin.P0)
``` ```
Grove - 4 digital display Measure distance in inches, specify the signal pin.
```blocks ```blocks
// Create a 4 Digital Display driver, specify the clk and data pin let distance = 0
let display = grove.createDisplay(DigitalPin.P0, DigitalPin.P1); distance = grove.measureInInches(DigitalPin.P0)
```
// Set the brightness level ### Grove - 4 digital display
display.set(7);
// Start display value Create a 4 Digital Display driver, specify the clk and data pin, and set the brightness level, then start display value.
display.show(1234); ```blocks
let display: grove.TM1637 = null
display = grove.createDisplay(DigitalPin.P0, DigitalPin.P1)
display.set(7)
display.show(1234)
``` ```
## More operation ## More operation
Grove - 4 digital display ### Grove - 4 digital display
```blocks
// After create a 4 Digital Display driver, it can display number "1234" one by one
display.bit(1, 0);
display.bit(2, 1)
display.bit(3, 2);
display.bit(4, 3)
```
Use ``point()`` to open or close point dispay. Use ``||bit||`` to display one bit number.
Use ``clear()`` to clean display. Use ``||point||`` to open or close point dispay.
Use ``||clear||`` to clean display.
## License ## License