@@ -4,7 +4,6 @@ import { html } from 'lit-html';
44import { fontA02 } from './lcd1602-font-a02' ;
55import './lcd1602-element' ;
66
7- const encode = ( s : string ) => new Uint8Array ( s . split ( '' ) . map ( ( c ) => c . charCodeAt ( 0 ) ) ) ;
87const helloWorld = 'Hello, World!' ;
98const symbols = '\x10 I \x9d Symbols! \x11\xab \x14\x18\x17\x1e \x91\x98\x96 \x93\x97\xa9 \xbb' ;
109
@@ -15,7 +14,7 @@ storiesOf('LCD1602', module)
1514 'Hello, World!' ,
1615 ( ) => html `
1716 < wokwi-lcd1602
18- .characters ="${ encode ( text ( 'value' , helloWorld ) ) } "
17+ .text ="${ text ( 'value' , helloWorld ) } "
1918 .cursor =${ boolean ( 'cursor' , false ) }
2019 .blink =${ boolean ( 'blink' , false ) }
2120 cursorX=${ number ( 'cursorX' , 0 , { min : 0 , max : 15 } ) }
@@ -31,30 +30,20 @@ storiesOf('LCD1602', module)
3130 color ="white "
3231 background ="blue "
3332 blink ="true "
34- .characters ="${ encode ( helloWorld ) } "
33+ .text ="${ helloWorld } "
3534 > </ wokwi-lcd1602 >
3635 `
3736 )
3837 . add (
3938 'Blinking cursor' ,
4039 ( ) => 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 >
4741 `
4842 )
4943 . add (
5044 'Cursor' ,
5145 ( ) => 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 >
5847 `
5948 )
6049 . add (
@@ -72,7 +61,7 @@ storiesOf('LCD1602', module)
7261 ( ) =>
7362 html `
7463 < wokwi-lcd1602
75- .characters ="${ encode ( text ( 'value' , symbols ) ) } "
64+ .text ="${ text ( 'value' , symbols ) } "
7665 .font =${ fontA02 }
7766 .cursor =${ boolean ( 'cursor' , false ) }
7867 .blink=${ boolean ( 'blink' , false ) }
@@ -83,21 +72,10 @@ storiesOf('LCD1602', module)
8372 )
8473 . add (
8574 '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 > `
9376 )
9477 . add (
9578 'No pins' ,
9679 ( ) =>
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 > `
10381 ) ;
0 commit comments