I’m using this code: https://playground.arduino.cc/Main/sourceblock_1/index.txt?action=sourceblock&num=1
Which is a very simple program to list out i2c devices. A key snippet:
Wire.begin();
Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
...
Here is the relevant part of my platformio.ini
[env:teensy41imu]
board = teensy41
monitor_speed = 115200
build_src_filter =
-<*>
+<i2c_scanner.cpp>
I am not sure what to do next. I have a raspberry Pi, connected to a teensy which has an IMU connected over i2c (as well as other devices.) On my Mac I am accessing the Pi remotely via vscode, using the platformio addin for platformio. All works well.
I upload the sketch successfully:
Processing teensy41imu (board: teensy41; platform: teensy; framework: arduino)
------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.18.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
- framework-arduinoteensy @ 1.158.0 (1.58)
- tool-teensy @ 1.158.0 (1.58)
- toolchain-gccarmnoneeabi-teensy @ 1.110301.0 (11.3.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 105 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Wire @ 1.0
Building in release mode
Linking .pio/build/teensy41imu/firmware.elf
Checking size .pio/build/teensy41imu/firmware.elf
Building .pio/build/teensy41imu/firmware.hex
Configuring upload protocol...
AVAILABLE: jlink, teensy-cli, teensy-gui
CURRENT: upload_protocol = teensy-cli
Rebooting...
Uploading .pio/build/teensy41imu/firmware.hex
Teensy Loader, Command Line, Version 2.2
Read ".pio/build/teensy41imu/firmware.hex": 25600 bytes, 1.3% usage
Unable to soft reboot with USB error: Success
Waiting for Teensy device...
(hint: press the reset button)
Found HalfKay Bootloader
Read ".pio/build/teensy41imu/firmware.hex": 25600 bytes, 1.3% usage
Programming......................
Booting
======================================= [SUCCESS] Took 5.48 seconds =======================================
Environment Status Duration
------------- -------- ------------
teensy41imu SUCCESS 00:00:05.477
======================================= 1 succeeded in 00:00:05.477 =======================================
* Terminal will be reused by tasks, press any key to close it.
Nothing happens. Guessing that maybe I need to click on Monitor, I see this:
Executing task in folder firmware: platformio device monitor --environment teensy41imu
--- Terminal on /dev/ttyUSB0 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
And. nothing more. What am I missing?