from machine import Pin,I2C
from ssd1306 import SSD1306_I2C
import random,time
i2c = I2C(0, scl=Pin(17), sda=Pin(16))
oled_width = 128
oled_height = 64
oled =SSD1306_I2C(oled_width, oled_height, i2c)
while True:
oled.fill(0)
#file=open("Data.txt" , "w")
#file.write("Data logged \n")
for secs in range(10):
data=str(secs+1) + " " + str(round(random.random(),5)) +"\n"
#file.write(data)
#time.sleep(1)
#file.close()
print("Data Logging Over..")
oled.text("data: ",0,20)
oled.text(str(data),80,20)
oled.show()
time.sleep(1)