Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2C ID change is not working properly #5

Open
yuregir opened this issue Feb 24, 2020 · 1 comment
Open

I2C ID change is not working properly #5

yuregir opened this issue Feb 24, 2020 · 1 comment

Comments

@yuregir
Copy link

yuregir commented Feb 24, 2020

To fix it change:

    @sensor_address.setter
    def sensor_address(self, new_addr):
       
        if isinstance(new_addr, int) and (new_addr >= 3 and new_addr <= 119):
            self.bus.write_byte_data(self.address, 1, new_addr)
            self.bus.write_byte_data(self.address, 1, new_addr)  #<= ADD THIS LINE
            self.reset()
            self.address = new_addr
        else:
            raise ValueError('I2C address must be between 3-119 or 0x03-0x77.')
@yuregir
Copy link
Author

yuregir commented Feb 24, 2020

Also created PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant