Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
902648c6a9 |
21
main.ts
21
main.ts
@@ -490,6 +490,26 @@ namespace grove {
|
|||||||
return RangeInInches;
|
return RangeInInches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new driver Grove - 4-Digit Display
|
||||||
|
* @param clkPin value of clk pin number
|
||||||
|
* @param dataPin value of data pin number
|
||||||
|
*/
|
||||||
|
//% blockId=grove_tm1637_create block="4-Digit Display at|%clkPin|and|%dataPin"
|
||||||
|
export function createDisplay(clkPin: DigitalPin, dataPin: DigitalPin): TM1637
|
||||||
|
{
|
||||||
|
let display = new TM1637();
|
||||||
|
|
||||||
|
display.buf = pins.createBuffer(4);
|
||||||
|
display.clkPin = clkPin;
|
||||||
|
display.dataPin = dataPin;
|
||||||
|
display.brightnessLevel = 0;
|
||||||
|
display.pointFlag = false;
|
||||||
|
display.clear();
|
||||||
|
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init Grove Gesture modules
|
* init Grove Gesture modules
|
||||||
*
|
*
|
||||||
@@ -517,4 +537,5 @@ namespace grove {
|
|||||||
export function getJoystick(xpin: AnalogPin, ypin: AnalogPin): number {
|
export function getJoystick(xpin: AnalogPin, ypin: AnalogPin): number {
|
||||||
return joystick.read(xpin, ypin);
|
return joystick.read(xpin, ypin);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user