Closed greg-norris closed 1 year ago
@greg-norris @gus-ghielec It's not a string that way, it's a string this way. Why is this a thing!?
The L is an enum created for the on-board LED pin. A & B are also enums created for the A & B button pins.
@dudedigital because web developers need to learn about ASCII vs strings and this is a very good spot to learn that.
'A' is ASCII A and it is a value (a number) "A" is a string of 2 bytes (usually) and has 'A' in the first element and null in the second element.
Also, "A" is a pointer to 2 element array. 'A' is a number not a pointer.
DUE will teach everyone proper coding.
for this to work properly in JSON, you will need to escape the single quote with backslash.
AWrite(\'L\', i)'
@gus-ghielec The average web developer isn't really concerned with low level stuff like those in hardware. It's two different worlds, and someone may not always be interested in both. I'm personally on the fence.
For me, I was in the wrong headspace. I wasn't thinking in terms of strongly-typed declarations. In this case, single quotes are treated as an ascii (char)acter. In a loosely typed language, 'A'
would be a string. I wouldn't define one or the other as proper or improper coding.
There are a couple of the DEMOS that have an issue.
1.) The Fade LED Demo code needs to be changed from "L" to 'L'.
@Loop For i=0 to 1000 Step 100 AWrite('L', i) Wait(100) Next For i=1000 to 0 Step -100 AWrite('L', i) Wait(100) Next Goto Loop
2.) The Read Button DEMO also has a similar issue. The "A" should be 'A'.
BtnEnable('A', 1) @Loop x=BtnDown('A') If x=1 PrintLn("Button A") End Wait(200) Goto Loop