I2C help needed
Posted: Sun Dec 13, 2015 10:28 am
I am working on a project to show the use of a 4 digit I2C display that I successfully was able to implement using the micromite. This chip is also programmed in basic, so I am trying to port over this project to the ESP. If I can figure out why this code is not working, it will make for a pretty cool project for Mikes website.
The following is a very stripped down bit of code just to show what I need to get working on the esp.
This program works with the display on the micromite...
The four lines toward the end are sending 2 bytes each to the display to show a number on each digit. Again, this code does work.
This is what I converted it to for the esp and can not for the life of me figure out why it won't work... I do have 4.7k pull-ups on the gpio's and am using GPIO0 for SDA and GPIO2 for SCL.
The following is a very stripped down bit of code just to show what I need to get working on the esp.
This program works with the display on the micromite...
Code: Select all
I2C OPEN 100,100 'OPEN I2C PORT
‘CONFIGURE DISPLAY
I2C WRITE &H70, 0, 1, &H21
I2C WRITE &H70, 0, 1, &H81
I2C WRITE &H70, 0, 1, &HEF
I2C WRITE &H70, 0, 2, &H00, &H06 ‘FIRST DIGIT
I2C WRITE &H70, 0, 2, &H02, &H5B ’SECOND DIGIT
I2C WRITE &H70, 0, 2, &H06, &H4F ‘THIRD DIGIT
I2C WRITE &H70, 0, 2, &H08, &H66 ’FORTH DIGIT
END
The four lines toward the end are sending 2 bytes each to the display to show a number on each digit. Again, this code does work.
This is what I converted it to for the esp and can not for the life of me figure out why it won't work... I do have 4.7k pull-ups on the gpio's and am using GPIO0 for SDA and GPIO2 for SCL.
Code: Select all
memclear
address = 112 'HEX 70
i2c.begin(address)
i2c.write(33) ‘HEX 21
i2c.write(129) ’HEX 81
i2c.write(239) ‘HEX EF
i2c.end()
delay 10
i2c.begin(address) ’FIRST DIGIT
i2c.write(0)
i2c.write(6)
i2c.end()
delay 10
i2c.begin(address) ‘SECOND DIGIT
i2c.write(2)
i2c.write(90)
i2c.end()
delay 10
i2c.begin(address) ’THRID DIGIT
i2c.write(6)
i2c.write(79)
i2c.end()
delay 10
i2c.begin(address) ‘FORTH DIGIT
i2c.write(8)
i2c.write(102)
i2c.end()
delay 10
end