supax.blogg.se

Stock arduino lcd library
Stock arduino lcd library











We control the 8 pixels unit with one hex number (which can be seen as 8-bit-binary number, and each bit controls a pixel).įor example, display a dot on the top left corner, we need to send a hex number 0x01 (B0000 0001) to the data register, e.g. The screen is divided into “8 pages” (I know it’s not divided into rows, but pages), and 128 columns. The matrix arrangement on the display is quite confusing. For more details on the registers and commands, check out the datasheet. There are mainly only two registers we need to know here, the command register (mentioned above), and data register, which we use to control the pixels on the screen. Wire.beginTransmission(0x3C) // might be different for your display Wire.endTransmission() // stop transmittingįor example, to shut down the display of address 0x3C, we change the data in register 0x40 (command register), with value 0xAE, which is the shutdown command. The code example would be: Wire.beginTransmission(devAddr) So to tell the display to do something, you basically need 3 parameters: device address, register address and the command. Again each register will have a unique hex address between 0x00 and 0xFF. Within the OLED display, there are many register, each register controls a certain functionality, such as inverting the display colour, or powering down the display. You need to specify the device address in order to talk to the device you want. As you might know i2c communication allows multiple devices to share the same connection, and each device will have a specific address in hex number between 0x00 and 0xFF. The OLED display is connected to the Arduino using i2c buses, so the “wire” library is used here. How the OLED Display is Communicated with Arduino Before we go onto explain how we use the library, I think it’s important that we understand how the OLED display works.













Stock arduino lcd library