lancaster-university / microbit-docs

http://lancaster-university.github.io/microbit-docs
Other
27 stars 28 forks source link

Using components directly page needs updating for the new sensor initialisation #74

Open microbit-carlos opened 5 years ago

microbit-carlos commented 5 years ago

https://lancaster-university.github.io/microbit-docs/advanced/#using-components-directly

Given example:

#include "MicroBit.h"

MicroBitI2C i2c = MicroBitI2C(I2C_SDA0, I2C_SCL0);
MicroBitAccelerometer accelerometer = MicroBitAccelerometer(i2c);
MicroBitDisplay display;

int main()
{
    while(1)
        display.scroll(accelerometer.getX());
}

We need to update it to use MicroBitAccelerometer::autoDetect(...) instead.