@@ -4,7 +4,6 @@ import { html } from 'lit-html';
4
4
import { fontA02 } from './lcd1602-font-a02' ;
5
5
import './lcd1602-element' ;
6
6
7
- const encode = ( s : string ) => new Uint8Array ( s . split ( '' ) . map ( ( c ) => c . charCodeAt ( 0 ) ) ) ;
8
7
const helloWorld = 'Hello, World!' ;
9
8
const symbols = '\x10 I \x9d Symbols! \x11\xab \x14\x18\x17\x1e \x91\x98\x96 \x93\x97\xa9 \xbb' ;
10
9
@@ -15,7 +14,7 @@ storiesOf('LCD1602', module)
15
14
'Hello, World!' ,
16
15
( ) => html `
17
16
< wokwi-lcd1602
18
- .characters ="${ encode ( text ( 'value' , helloWorld ) ) } "
17
+ .text ="${ text ( 'value' , helloWorld ) } "
19
18
.cursor =${ boolean ( 'cursor' , false ) }
20
19
.blink =${ boolean ( 'blink' , false ) }
21
20
cursorX=${ number ( 'cursorX' , 0 , { min : 0 , max : 15 } ) }
@@ -31,30 +30,20 @@ storiesOf('LCD1602', module)
31
30
color ="white "
32
31
background ="blue "
33
32
blink ="true "
34
- .characters ="${ encode ( helloWorld ) } "
33
+ .text ="${ helloWorld } "
35
34
> </ wokwi-lcd1602 >
36
35
`
37
36
)
38
37
. add (
39
38
'Blinking cursor' ,
40
39
( ) => html `
41
- < wokwi-lcd1602
42
- .characters ="${ encode ( helloWorld ) } "
43
- blink ="true "
44
- cursorX ="7 "
45
- cursorY ="1 "
46
- > </ wokwi-lcd1602 >
40
+ < wokwi-lcd1602 .text ="${ helloWorld } " blink ="true " cursorX ="7 " cursorY ="1 "> </ wokwi-lcd1602 >
47
41
`
48
42
)
49
43
. add (
50
44
'Cursor' ,
51
45
( ) => html `
52
- < wokwi-lcd1602
53
- .characters ="${ encode ( helloWorld ) } "
54
- cursor ="true "
55
- cursorX ="7 "
56
- cursorY ="1 "
57
- > </ wokwi-lcd1602 >
46
+ < wokwi-lcd1602 .text ="${ helloWorld } " cursor ="true " cursorX ="7 " cursorY ="1 "> </ wokwi-lcd1602 >
58
47
`
59
48
)
60
49
. add (
@@ -72,7 +61,7 @@ storiesOf('LCD1602', module)
72
61
( ) =>
73
62
html `
74
63
< wokwi-lcd1602
75
- .characters ="${ encode ( text ( 'value' , symbols ) ) } "
64
+ .text ="${ text ( 'value' , symbols ) } "
76
65
.font =${ fontA02 }
77
66
.cursor =${ boolean ( 'cursor' , false ) }
78
67
.blink=${ boolean ( 'blink' , false ) }
@@ -83,21 +72,10 @@ storiesOf('LCD1602', module)
83
72
)
84
73
. add (
85
74
'I²C pins' ,
86
- ( ) =>
87
- html `
88
- < wokwi-lcd1602
89
- .characters ="${ encode ( 'I only need 4 pins!' ) } "
90
- pins ="i2c "
91
- > </ wokwi-lcd1602 >
92
- `
75
+ ( ) => html ` < wokwi-lcd1602 text ="I only need 4 pins! " pins ="i2c "> </ wokwi-lcd1602 > `
93
76
)
94
77
. add (
95
78
'No pins' ,
96
79
( ) =>
97
- html `
98
- < wokwi-lcd1602
99
- .characters ="${ encode ( 'Look ma! I got no pins' ) } "
100
- pins ="none "
101
- > </ wokwi-lcd1602 >
102
- `
80
+ html ` < wokwi-lcd1602 text ="Look ma! I got no pins " pins ="none "> </ wokwi-lcd1602 > `
103
81
) ;
0 commit comments