Hi I need to change I2C address and will then get this from a variable.
the reason is that my I2C chips do not always have the same address as I will then make a autosearch for the address and store it in a variable so that I then can use it lcd_I2C address. autosearch part I get but I am unable to change I2C address in lcd_i2c component.
is there anyone who can give me an example of how I can change i2c address
thanks
lcd_i2c component
Moderator: Benj
-
- Valued Contributor
- Posts: 1208
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
Re: lcd_i2c component
Unfortunately - the flowcode component has the address 'hardcoded' in - have a look at the C code (for example SendCommand). For example in the case of SSD1306(i2c) - 120....
The actual address is only used in a few places (SendCommand for example) - so these could be modified to use a variable rather than a constant...
With the source to the component - this would be straightforward (Seti2cAddress macro??) Benj might oblige?
Harder(!) - copy the C code to supplemntary code for the project and modify the commands you need (for example Print) to take an address as an extra argument of address (if you need more than one display) or to use a variable - if just one display...
Martin
The actual address is only used in a few places (SendCommand for example) - so these could be modified to use a variable rather than a constant...
With the source to the component - this would be straightforward (Seti2cAddress macro??) Benj might oblige?
Harder(!) - copy the C code to supplemntary code for the project and modify the commands you need (for example Print) to take an address as an extra argument of address (if you need more than one display) or to use a variable - if just one display...
Martin