initialization needs to be moved to constructor. int _CS = 10; bool I2C = true; unsigned long SPIfreq = 5000000;