This commit is contained in:
WayenWeng 2017-06-28 13:39:51 +08:00
parent 7be81d842d
commit dfbec0e343
3 changed files with 11 additions and 10 deletions

View File

@ -19,19 +19,19 @@ grove.onGesture(GroveGesture.Down, () => {
Grove - Ultrasonic Ranger
```blocks
// Measure distance in centimeters, specify the signal pin
let distance = Grove_Ultrasonic_Ranger.measureInCentimeters(DigitalPin.P0);
let distance = grove.measureInCentimeters(DigitalPin.P0);
// Measure distance in inches, specify the signal pin
let distance = Grove_Ultrasonic_Ranger.measureInInches(DigitalPin.P0);
let distance = grove.measureInInches(DigitalPin.P0);
```
Grove - 4 digital display
```blocks
// Create a 4 Digital Display driver, specify the clk and data pin
let display = Grove_4_Digital_Display.create(DigitalPin.P0, DigitalPin.P1);
let display = grove.createDisplay(DigitalPin.P0, DigitalPin.P1);
// Set the brightness level
display.set(BrightnessLevel.LEVEL_7);
display.set(7);
// Start display value
display.show(1234);
@ -42,10 +42,10 @@ display.show(1234);
Grove - 4 digital display
```blocks
// After create a 4 Digital Display driver, it can display number "1234" one by one
display.bit(0, 1);
display.bit(1, 2)
display.bit(2, 3);
display.bit(3, 4)
display.bit(1, 0);
display.bit(2, 1)
display.bit(3, 2);
display.bit(4, 3)
```
Use ``point()`` to open or close point dispay.

View File

@ -145,7 +145,7 @@ namespace grove {
* @param dataPin value of data pin number
*/
//% blockId=grove_tm1637_create block="4-Digit Display at|%clkPin|and|%dataPin"
export function dislay(clkPin: DigitalPin, dataPin: DigitalPin): TM1637
export function createDisplay(clkPin: DigitalPin, dataPin: DigitalPin): TM1637
{
let display = new TM1637();

View File

@ -21,7 +21,7 @@ grove.onGesture(GroveGesture.Anticlockwise, () => {
})
{
let display = grove.dislay(DigitalPin.P2, DigitalPin.P16);
let display = grove.createDisplay(DigitalPin.P0, DigitalPin.P1);
let data = 0;
display.point(true);
@ -45,6 +45,7 @@ grove.onGesture(GroveGesture.Anticlockwise, () => {
basic.pause(500);
display.set(7);
while(true)
{
display.show(data ++);