orsjb / HappyBrackets

HappyBrackets is an audio-focused library and toolkit for creative coding for the internet of things.
Apache License 2.0
36 stars 3 forks source link

Use array of sensors for generic accelerometer gyroscope, etc... #55

Open angelofraietta opened 6 years ago

angelofraietta commented 6 years ago

Use an array of sensors to iterate and detect the specific sensors rather than

        System.out.println("Try Load LSM95DS1");
        try {
            LSM9DS1 sensor = (LSM9DS1) getSensor(LSM9DS1.class);

            if (sensor == null) {
                sensor = LSM9DS1.class.getConstructor().newInstance();
            }

instead, do static Sensor [] ={LSM9DS1.class, MiniMU.class};

This will make easier to update and add new sensors later with minimal code change.

angelofraietta commented 6 years ago

Also, add an ADD sensor to the generic classes of Accelerometer, Gyroscope, etc... , so user can make a new driver and add it to Acceleormeter, and just do a get.sensort(Acceleormeter.class) without having to get inside the Jar file