I got this bit of code and it won't compile. It shows me that there are unbalanced brackets. I don't know why it won't compile. Can anyone tell me what's wrong?
' Define segment patterns for 0-9 digits
DIM DigitPatterns(9) AS BYTE[8] = [ _
&B00111111,
&B00000110,
&B01011011,
&B01001111,
&B01100110,
&B01101101,
&B01111101,
&B00000111,
&B01111111,
&B01101111
]
Thanks,
Harley
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
' Define segment patterns for 0-9 digits
DIM DigitPatterns(9) AS BYTE[8] = [ _
&B00111111,
&B00000110,
&B01011011,
&B01001111,
&B01100110,
&B01101101,
&B01111101,
&B00000111,
&B01111111,
&B01101111
]
'Create an array to store the character until it is copied Dim CharArray(8)'Set the array to hold the character'Binary has been used to improve the readability of the code, but is not essentialCharArray(1)=b'00011011'CharArray(2)=b'00011011'CharArray(3)=b'00000000'CharArray(4)=b'00000100'CharArray(5)=b'00000000'CharArray(6)=b'00010001'CharArray(7)=b'00010001'CharArray(8)=b'00001110''Copy the character from the array to the LCD LCDCreateChar 0, CharArray()'Draw the custom character LCDWriteChar 0
Another way ... and, there may be more ways . :-)
Dim CharArray(10) as Byte
CharArray = 0B00111111, 0B00000110, 0B01011011, 0B01001111, 0B01100110, 0B01101101, 0B01111101, 0B00000111, 0B01111111, 0B01101111
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got this bit of code and it won't compile. It shows me that there are unbalanced brackets. I don't know why it won't compile. Can anyone tell me what's wrong?
' Define segment patterns for 0-9 digits
DIM DigitPatterns(9) AS BYTE[8] = [ _
&B00111111,
&B00000110,
&B01011011,
&B01001111,
&B01100110,
&B01101101,
&B01111101,
&B00000111,
&B01111111,
&B01101111
]
Thanks,
Harley
Hello Harley,
See https://gcbasic.sourceforge.io/help/_lcdcreatechar.html to create a custom character that uses the array construct.
' Define segment patterns for 0-9 digits
DIM DigitPatterns(9) AS BYTE[8] = [ _
&B00111111,
&B00000110,
&B01011011,
&B01001111,
&B01100110,
&B01101101,
&B01111101,
&B00000111,
&B01111111,
&B01101111
]
Another way ... and, there may be more ways . :-)
Another way.... looks more like the original...
Porting from another language can be challenging. :-)