Decimal-to-Binary conversion
Posted: Fri Feb 24, 2017 3:10 am
Let's move formward with the colection of the handy subroutines and implement a decimal-to-binary conversion one:
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.
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.