16 lines
347 B
Python
16 lines
347 B
Python
|
import Adafruit_ADS1x15
|
||
|
|
||
|
adc = Adafruit_ADS1x15.ADS1115(address=0x48, busnum=1)
|
||
|
|
||
|
binary_string = ''
|
||
|
random_number = 0
|
||
|
|
||
|
for i in range(1024):
|
||
|
raw_value = adc.read_adc(0, gain=1)
|
||
|
|
||
|
lsb =(raw_value & 0x01) << i
|
||
|
|
||
|
#binary_string= bin(lsb)[2:].zfill(32) + binary_string
|
||
|
random_number |= lsb
|
||
|
|
||
|
print("Random Number:", random_number)
|