I changed the address of the sensor by sensor.setAddress(), and it showed the new address. But next time, I again uploaded , and it said the sensor cannot be initialized. Anybody who knows how to deal with this problem?
The sensor always reverts back to the default address when it is powered up or reset. If you want to use a different address, you will need to change it every time one of those two actions occur.
If you are trying to change the address to use multiple sensors, you might refer to this thread on our forum.
Thank you very much. It worked.