@@lorisrobots Hi, My son ran the Advance Version but it didn't allow us to run it, it kept sending us this error: Traceback (most recent call last): File "", line 29, in NameError: name 'keyboardInterrupt' isn't defined
Thank you, Lori. I was able to follow your logic explanation and code to add additional LEDs (and have it work :-) ) I did all of the "beginner code" for the five LEDs; zero to 31 and 31 to zero. A LOT of copy and paste :-( .
xval=13;; "{0:04b}".format(xval) gives 1101;; xval=23 gives '10111' so the {0:04b} is just a suggestion as is {:b} , xval=13;; bin(xval) gives 0b1101;; x=bin(xval)[2:6] gives 1101;; xval=23;; x=bin(xval)[2:6] gives 1011, fixed length from '0b10111' to reverse string : x_reversedstring = ''.join(reversed(x)) (tested on MicroPython v1.19.1) want last 4 then bin(xval)[-4:]
Thanks for sharing. I am only counting from 0 to 15 so getting to 23 doesn't happen in my program. Also the way the code works, it pulls the zeros and ones from the indexes zero through three regardless of the length of myBin. If you wished to display a decimal "23", you would need five LEDs to display that number. I believe the concept of my program would work just fine going to binary numbers that need five places. The code would need to change to {0:05b}.format(myNum) to go that high and then you would need to add one more LED to get the additional binary digit. Best wishes.
nice job.... I really like your video and format.. The one thing I am struggling with the working storage size of the varables. wth python, and micro python how do you know the storage size? like is a 2 byte integer, 4 byte integer, or 8 byte integer, same thing with float.... Anyway if you have time and the answer is easy sure would like to understand this. Take Care, and I really did like your solution.
That is a detailed question that I don't really know how to best answer. I am still learning too. I think you can control the size of the variables as you set them up. I haven't really needed to address that so far - I just use the defaults. Hope you can find your answer. Thanks for watching!