File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed
Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 2929#else
3030 ICM_20948_I2C myICM; // Otherwise create an ICM_20948_I2C object
3131#endif
32-
32+
3333
3434void setup () {
3535
3636 SERIAL_PORT.begin (115200 );
3737 while (!SERIAL_PORT){};
38+
39+ #ifdef USE_SPI
40+ SPI_PORT.begin ();
41+ #else
42+ WIRE_PORT.begin ();
43+ WIRE_PORT.setClock (400000 );
44+ #endif
3845
3946 bool initialized = false ;
4047 while ( !initialized ){
4148
4249#ifdef USE_SPI
43- SPI_PORT.begin ();
4450 myICM.begin ( CS_PIN, SPI_PORT );
4551#else
46- WIRE_PORT.begin ();
47- WIRE_PORT.setClock (400000 );
4852 myICM.begin ( WIRE_PORT, AD0_VAL );
4953#endif
5054
Original file line number Diff line number Diff line change 3434void setup () {
3535
3636 SERIAL_PORT.begin (115200 );
37- while (!SERIAL_PORT){};
37+ while (!SERIAL_PORT){};
38+
39+ #ifdef USE_SPI
40+ SPI_PORT.begin ();
41+ #else
42+ WIRE_PORT.begin ();
43+ WIRE_PORT.setClock (400000 );
44+ #endif
3845
3946 bool initialized = false ;
4047 while ( !initialized ){
4148
4249#ifdef USE_SPI
43- SPI_PORT.begin ();
4450 myICM.begin ( CS_PIN, SPI_PORT );
4551#else
46- WIRE_PORT.begin ();
47- WIRE_PORT.setClock (400000 );
4852 myICM.begin ( WIRE_PORT, AD0_VAL );
4953#endif
5054
@@ -57,6 +61,7 @@ void setup() {
5761 initialized = true ;
5862 }
5963 }
64+ }
6065
6166 // In this advanced example we'll cover how to do a more fine-grained setup of your sensor
6267 SERIAL_PORT.println(" Device connected!" );
You can’t perform that action at this time.
0 commit comments