Compile and upload code: Difference between revisions

From Rsewiki
Line 13: Line 13:
[[file:MS_Visual_studio_code_1.png | 500px]]
[[file:MS_Visual_studio_code_1.png | 500px]]


Connect the robot using a USB. Turning on the robot is not strictly needed, as the USB will provide sufficient power to make the upload.
Connect the robot using a USB. Turning on the robot is not strictly necessary, as the USB will provide sufficient power for the upload.


Use the PlatformIO -> PROJECT TASKS -> teensy 4.1 -> General -> Upload and Monitor
Use the PlatformIO -> PROJECT TASKS -> teensy 4.1 -> General -> Upload and Monitor
Line 21: Line 21:
[[File: MS_Visual_studio_code_upload.png | 500px]]
[[File: MS_Visual_studio_code_upload.png | 500px]]


Note that at the bottom, there are two lines from the robot (marked in blue), something like:
Note that at the bottom, there are one or two lines from the robot (marked in blue), something like:


  % Robot 52 Adriana (PCB version 6.3)
  % Robot 42 Aya (PCB version 6.3, SVN version 40, battery 11.5 V)
% UImu2:: gyro offset: 2.20459 -0.896149 0.737335


This indicates that the firmware is running (and that the gyro is calibrated).
This indicates that the firmware is running.


There are a few commands available from the command line, e.g. type ''help'' and return to get:
There are a few commands available from the command line, e.g. type ''help'' and return to get:
Line 40: Line 39:
  % --    reboot  Reboot Teensy
  % --    reboot  Reboot Teensy
  % --    log    Print log
  % --    log    Print log
  % --    help    Send on-line help
  % --    help    Send online help
  %% USB -------
  %% USB -------
  % --    echo A  Send received characters back as received. A=0 not, A=1 yes (is=1)
  % --    echo A  Send received characters back as received. A=0 not, A=1 yes (is=1)

Revision as of 16:34, 30 August 2025

Back to Basebot.

Compile the code

Use the PlatformIO -> PROJECT TASKS -> teensy 4.1 -> General -> build to compile the project.

It should now compile with a "SUCCESS" result, something like the one shown here:

Click on the "explorer" and find the source code:

Connect the robot using a USB. Turning on the robot is not strictly necessary, as the USB will provide sufficient power for the upload.

Use the PlatformIO -> PROJECT TASKS -> teensy 4.1 -> General -> Upload and Monitor

This should open the loader app, find the correct USB port, upload the code and start the serial monitor.

Note that at the bottom, there are one or two lines from the robot (marked in blue), something like:

% Robot 42 Aya (PCB version 6.3, SVN version 40, battery 11.5 V)

This indicates that the firmware is running.

There are a few commands available from the command line, e.g. type help and return to get:

help
% Available commands from Basebot:
%% Robot settings -------
% --    setidx N        Set ID to N (sets robot name) (id=42)
% --    sethw P         Set PCB version to P (is=9) 9=PCB6.3
% --    start   Start (same as start button)
% --    version         Get version in SVN (is 37)
% --    power 0/1       12V power 1=on (is 1)
% --    reboot  Reboot Teensy
% --    log     Print log
% --    help    Send online help
%% USB -------
% --    echo A  Send received characters back as received. A=0 not, A=1 yes (is=1)
%% Motor -------
% --    motv m1 m2      Set motor voltage -12.0..12.0 - and enable motors
% --    motfrq  Set motor PWM frequency [100..100000], is 80000
% --    stop    Calls the function stop(0.02)
%% Encoder settings -------
% --    confw ppr       Set configuration (ppr: pulse per revolution, is 48)
% --    encf F C        Use fast estimate (F=0 delay but cleaner, F=1 faster, is 0; C=0 don't compensate, U=1 compensate, is=0)
%% IMU -------
% --    gyroc   Start gyro calibration (finished=1)
%% EE (configuration flash) --------
% --    eew     Save configuration to EE-Prom (flash)
% --    eer     Read configuration from EE-Prom