Always beginner with Micropython on ESP32 ....
You will anderstand my question by this exemple it's a simply program that display temperature of a DS18B20 on a Oled Display SSD1306:
Code: Select all
from machine import Pin,SoftI2C
import ssd1306
import time
import machine
import onewire, ds18x20
dat = machine.Pin(12) # the device is on GPIO12
i2c = SoftI2C(scl=Pin(5), sda=Pin(4), freq=100000) #Init i2c
lcd=ssd1306.SSD1306_I2C(128,64,i2c) #create LCD object,Specify col and row
ds = ds18x20.DS18X20(onewire.OneWire(dat)) # create the onewire object
roms = ds.scan() # scan for devices on the bus
try:
while True:
ds.convert_temp()
time.sleep_ms(750) #The reading temperature needs at least 750ms
for rom in roms:
lcd.fill(0)
lcd.text("temperatures:",10,16)
lcd.text(str(ds.read_temp(rom)),40,40)
lcd.show()
except KeyboardInterrupt:
pass
I have downloaded the SSD1306.py on the board before , this is the only file i had to download......
After that I download my program on the board and I give to it the name "main.py", I have done like that for other program and it work well
But this program do not work ? I don't know why, but it's possible that my board do not contain files like onewire.py or ds18x20.py (perhaps ?) , these files are on my computer mandatorily but where ?
My question is how to find the files usefull for my ESP32 on my computer , i will be able to transfert then after on my board if necessary ?
A great thanks for all help
best regards