added i2c control and random function