A Basic Interpreter written from scratch for the ESP8266

Moderator: Mmiscool

User avatar
By dilettante
#59795 It isn't clear to me how you set the I2C OLED address to use with Basic's OLED operations. Are you assuming an address? Can you simply call i2c.begin() first to override the default is one is being assumed?

Are these 7 bit or 8 bit addresses?

Sorry, I assume this is all covered elsewhere but I haven't found it yet.
User avatar
By robert badiduwitz
#59800 Probably the easiest thing to do is load an I2C scanner program to see what the address of your OLED is as seen by the ESP8266. Make sure you have pullups on the I2C pins. Also change the pins to what ever your setup is. In this program it is using 4 and 5.

Code: Select alli2c.setup(4,5)

for address = 1 to 127
 i2c.begin(address)
 stat = i2c.end()

 if stat < 1 then
  'print stat
  wprint "Found I2C device at address: 0x" & hex(address)
  wprint " - > " & address
  wprint " <br>"
 endif

next address

wait



EDIT...

Now that I look at the manual, there is no way to define the address of the oled using the oled commands. Definitely one for Mike. Maybe he can add an oled setup type command or something.
User avatar
By trackerj
#59816
robert badiduwitz wrote:Probably the easiest thing to do is load an I2C scanner program to see what the address of your OLED is as seen by the ESP8266. Make sure you have pullups on the I2C pins. Also change the pins to what ever your setup is. In this program it is using 4 and 5.

Code: Select alli2c.setup(4,5)

for address = 1 to 127
 i2c.begin(address)
 stat = i2c.end()

 if stat < 1 then
  'print stat
  wprint "Found I2C device at address: 0x" & hex(address)
  wprint " - > " & address
  wprint " <br>"
 endif

next address

wait



EDIT...

Now that I look at the manual, there is no way to define the address of the oled using the oled commands. Definitely one for Mike. Maybe he can add an oled setup type command or something.


OLED Display address in case of a I2C compatible one IS the I2C address found by the scanner, no other function needed to define the address of the OLED Display.

This is working for me:

Code: Select alllet v = 100
i2c.setup(4,5)
lcdbl 1
oledcls
oledprint "Hello", 0, 0
oledprint v, 3, 3
wait


IF you want to use more than one I2C OLED Display in the same time...then might become tricky :)
User avatar
By dilettante
#59840 As far as I can tell the libraries commonly used on ESP8266 accept 7-bit I2C addresses. Good enough, but good to know. A little disappointing there is no I2C hardware level support, but it's not as if the ESP is multitasking so the overhead for bitbanging doesn't matter.

I just checked an OLED here and it is addressed 0x78, which as a 7-bit address should be 0x3C, which what I believe Basic uses right now. I think I was thrown because the PCB appeared to be marked 7A/7B instead of 7A/78.

So yes, unless one wanted to run 2 OLEDs things should be fine as is.