Update
This commit is contained in:
parent
7be81d842d
commit
dfbec0e343
16
README.md
16
README.md
@ -19,19 +19,19 @@ grove.onGesture(GroveGesture.Down, () => {
|
|||||||
Grove - Ultrasonic Ranger
|
Grove - Ultrasonic Ranger
|
||||||
```blocks
|
```blocks
|
||||||
// Measure distance in centimeters, specify the signal pin
|
// 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
|
// 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
|
Grove - 4 digital display
|
||||||
```blocks
|
```blocks
|
||||||
// Create a 4 Digital Display driver, specify the clk and data pin
|
// 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
|
// Set the brightness level
|
||||||
display.set(BrightnessLevel.LEVEL_7);
|
display.set(7);
|
||||||
|
|
||||||
// Start display value
|
// Start display value
|
||||||
display.show(1234);
|
display.show(1234);
|
||||||
@ -42,10 +42,10 @@ display.show(1234);
|
|||||||
Grove - 4 digital display
|
Grove - 4 digital display
|
||||||
```blocks
|
```blocks
|
||||||
// After create a 4 Digital Display driver, it can display number "1234" one by one
|
// After create a 4 Digital Display driver, it can display number "1234" one by one
|
||||||
display.bit(0, 1);
|
display.bit(1, 0);
|
||||||
display.bit(1, 2)
|
display.bit(2, 1)
|
||||||
display.bit(2, 3);
|
display.bit(3, 2);
|
||||||
display.bit(3, 4)
|
display.bit(4, 3)
|
||||||
```
|
```
|
||||||
|
|
||||||
Use ``point()`` to open or close point dispay.
|
Use ``point()`` to open or close point dispay.
|
||||||
|
2
main.ts
2
main.ts
@ -145,7 +145,7 @@ namespace grove {
|
|||||||
* @param dataPin value of data pin number
|
* @param dataPin value of data pin number
|
||||||
*/
|
*/
|
||||||
//% blockId=grove_tm1637_create block="4-Digit Display at|%clkPin|and|%dataPin"
|
//% 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();
|
let display = new TM1637();
|
||||||
|
|
||||||
|
3
test.ts
3
test.ts
@ -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;
|
let data = 0;
|
||||||
|
|
||||||
display.point(true);
|
display.point(true);
|
||||||
@ -45,6 +45,7 @@ grove.onGesture(GroveGesture.Anticlockwise, () => {
|
|||||||
basic.pause(500);
|
basic.pause(500);
|
||||||
|
|
||||||
display.set(7);
|
display.set(7);
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
display.show(data ++);
|
display.show(data ++);
|
||||||
|
Loading…
Reference in New Issue
Block a user