7
7
/**
8
8
* Custom blocks
9
9
*/
10
- //% weight=100 color=#0fbc11 icon="▀"
10
+ //% weight=20 color=#0fbc11 icon="▀"
11
11
namespace I2C_LCD1602 {
12
12
let i2cAddr : number // 0x3F: PCF8574A, 0x27: PCF8574
13
13
let BK : number // backlight control
@@ -77,6 +77,7 @@ namespace I2C_LCD1602 {
77
77
*/
78
78
//% blockId="I2C_LCD1620_SET_ADDRESS" block="LCD initialize with Address %addr"
79
79
//% weight=100 blockGap=8
80
+ //% parts=LCD1602_I2C trackArgs=0
80
81
export function LcdInit ( Addr : number ) {
81
82
if ( Addr == 0 ) i2cAddr = AutoAddr ( )
82
83
else i2cAddr = Addr
@@ -104,6 +105,7 @@ namespace I2C_LCD1602 {
104
105
//% weight=90 blockGap=8
105
106
//% x.min=0 x.max=15
106
107
//% y.min=0 y.max=1
108
+ //% parts=LCD1602_I2C trackArgs=0
107
109
export function ShowNumber ( n : number , x : number , y : number ) : void {
108
110
let s = n . toString ( )
109
111
ShowString ( s , x , y )
@@ -119,6 +121,7 @@ namespace I2C_LCD1602 {
119
121
//% weight=90 blockGap=8
120
122
//% x.min=0 x.max=15
121
123
//% y.min=0 y.max=1
124
+ //% parts=LCD1602_I2C trackArgs=0
122
125
export function ShowString ( s : string , x : number , y : number ) : void {
123
126
let a : number
124
127
@@ -139,6 +142,7 @@ namespace I2C_LCD1602 {
139
142
*/
140
143
//% blockId="I2C_LCD1620_ON" block="turn on LCD"
141
144
//% weight=81 blockGap=8
145
+ //% parts=LCD1602_I2C trackArgs=0
142
146
export function on ( ) : void {
143
147
cmd ( 0x0C )
144
148
}
@@ -148,6 +152,7 @@ namespace I2C_LCD1602 {
148
152
*/
149
153
//% blockId="I2C_LCD1620_OFF" block="turn off LCD"
150
154
//% weight=80 blockGap=8
155
+ //% parts=LCD1602_I2C trackArgs=0
151
156
export function off ( ) : void {
152
157
cmd ( 0x08 )
153
158
}
@@ -157,6 +162,7 @@ namespace I2C_LCD1602 {
157
162
*/
158
163
//% blockId="I2C_LCD1620_CLEAR" block="clear LCD"
159
164
//% weight=85 blockGap=8
165
+ //% parts=LCD1602_I2C trackArgs=0
160
166
export function clear ( ) : void {
161
167
cmd ( 0x01 )
162
168
}
@@ -166,6 +172,7 @@ namespace I2C_LCD1602 {
166
172
*/
167
173
//% blockId="I2C_LCD1620_BACKLIGHT_ON" block="turn on backlight"
168
174
//% weight=71 blockGap=8
175
+ //% parts=LCD1602_I2C trackArgs=0
169
176
export function BacklightOn ( ) : void {
170
177
BK = 8
171
178
cmd ( 0 )
@@ -176,6 +183,7 @@ namespace I2C_LCD1602 {
176
183
*/
177
184
//% blockId="I2C_LCD1620_BACKLIGHT_OFF" block="turn off backlight"
178
185
//% weight=70 blockGap=8
186
+ //% parts=LCD1602_I2C trackArgs=0
179
187
export function BacklightOff ( ) : void {
180
188
BK = 0
181
189
cmd ( 0 )
@@ -186,6 +194,7 @@ namespace I2C_LCD1602 {
186
194
*/
187
195
//% blockId="I2C_LCD1620_SHL" block="Shift Left"
188
196
//% weight=61 blockGap=8
197
+ //% parts=LCD1602_I2C trackArgs=0
189
198
export function shl ( ) : void {
190
199
cmd ( 0x18 )
191
200
}
@@ -195,6 +204,7 @@ namespace I2C_LCD1602 {
195
204
*/
196
205
//% blockId="I2C_LCD1620_SHR" block="Shift Right"
197
206
//% weight=60 blockGap=8
207
+ //% parts=LCD1602_I2C trackArgs=0
198
208
export function shr ( ) : void {
199
209
cmd ( 0x1C )
200
210
}
0 commit comments