Speed counting

{% trans 'Sorry, your browser does not support canvas -- please either update your browser or submit your requirements by phone or email.' %}

Accelerometer

Avatar for Dave Thwaites Dave Thwaites

How fast can CodeBug count? Press and hold the A button for a (short) while, then release the button, and the display will tell you how high codebug managed to count in the time you were pressing the button! Turns out a CodeBug can count really fast, and can only count so high! It takes less than 1 second for 'count' to reach over 32,000! More specifically, we reach 32,767 and then 'count' changes to -32,768 and continues up from there... This is to do with how CodeBug stores its numbers internally - it would appear to store each variable as a signed 16-bit number, and doesn't necessarily watch out for overflows... If that doesn't make sense, I don't have the space to explain here - look it up somewhere! After tweaking the code to allow for this, the emulator (on my Chromebook) can count to about 660 in 10s, whereas my CodeBug can count to about 555,000 in 10s!!!

Report this project
Back to top