A Basic Interpreter written from scratch for the ESP8266

Moderator: Mmiscool

User avatar
By trackerj
#62956 Let's move formward with the colection of the handy subroutines and implement a decimal-to-binary conversion one:

Code: Select all [decbin]
  i = 1
  r = 0
  binval = 0
  nr = decval
 Do
   r = nr % 2
   nr = int(nr/2)
   binval = binval + r*i
   i = i*10
 Loop while nr > 0
wait


Original article with full program code :
ESPBasic decimal-to-binary conversion code and test program

Looking forward to hear about your own ideas/solutions.

Happy breadboarding,
TJ.