Prepare for compile: Difference between revisions

From Rsewiki
 
(7 intermediate revisions by the same user not shown)
Line 3: Line 3:
== Development environment (IDE) ==
== Development environment (IDE) ==


=== Arduino ===
The Basebot code can be maintained in either Arduino IDE, by Microsoft Visual Studio Code, or from the command line (using any editor).
 
Arduino and MS Code has requirements to the file name and directory structure.
The default naming follows the Arduino standard (the directory name and the ino file name must be the same).
 
== Arduino ==


Install Arduino support; see [[Arduino and Teensy libraries]]
Install Arduino support; see [[Arduino and Teensy libraries]]
Line 23: Line 28:
The '''basebot''' will send data to the serial monitor. This data needs to be stored in a file for Matlab use, and another serial monitor or other tool probably has to be used.  
The '''basebot''' will send data to the serial monitor. This data needs to be stored in a file for Matlab use, and another serial monitor or other tool probably has to be used.  


=== Visual studio code (Linux) ===
== Visual Studio Code ==
 
Install MS Visual Studio; see [[Visual studio support | Visual studio install]]


Create a directory called '''src''' that links to the '''basebot_6''' directory.
To use this tool, some directory structure and file names are required.
In a terminal in the working directory where you installed the code:


cd basebot
So; rename two files:
ln -s basebot_6 src
* In the directory (where the platformio.ini resides):
** rename the directory ''basebot_6'' to ''src''. (Otherwise, the code will not be found by MS Code.)
* In this renamed directory:
** rename basebot_6.ino to basebot_6.cpp. (Otherwise, code editor tools will be limited.)
** Note! On Windows, this changes the file type, so it must be visible. In the File Explorer, select ''View'' > ''Show'' > ''File name extensions'' before renaming.


This step is needed, as '''MS Visual Studio Code''' need this directory for the actual code.
Install MS Visual Studio and PlatformIO; see [[Visual studio support | Visual studio install]]


=== Visual studio code (Windows) ===
In MS-Code, open the basebot code using the PlatformIO icon [[file:MS_Visual_Studio_Code_Platform_IO_icon.png]]:
 
Install MS Visual Studio; see [[Visual studio support | Visual studio install]]
 
Rename the '''basebot_6''' directory to '''src''', as this is mandatory for '''MS Visual studio code'''.
 
Open the code using the PlatformIO icon [[file:MS_Visual_Studio_Code_Platform_IO_icon.png]]:


PlatformIO -> "QUICK ACCESS" -> "PIO Home" -> "Open" and here press "Open Project"
PlatformIO -> "QUICK ACCESS" -> "PIO Home" -> "Open" and here press "Open Project"
Line 47: Line 47:
[[file: MS_Visual_Studio_Code_new_project_1.png | 500px]]
[[file: MS_Visual_Studio_Code_new_project_1.png | 500px]]


Find the ''Basebot'' directory - it holds the ''platformio.ini'' file needed to configure the project (i.e. Teensy 4.1, and the libraries needed).
Find the ''Basebot'' directory - it contains the ''platformio.ini'' file needed to configure the project (i.e., Teensy 4.1 and the required libraries).


Then, PlatformIO will install dependencies and check the project. If there is an error, read the error text and try to fix it.
Then, PlatformIO will install dependencies and check the project. If there is an error, read the error text and try to fix it.


=== Makefile ===
== Command line compile and upload ==
 
If you use any other development platform (or just an editor), then using the provided Makefile could be an option.


However, as Arduino was changed to version 2.*, support for Makefile was reduced, or at least more difficult.
This is a possibility when running Linux.
If you would use the Makefile, install version 1.8.19 of Arduino and the corresponding version of Teensyduino.


One line (line 31) in the Makefile should be changed so that '''BASEPATH''' points to the installed version.
Refer to the command-line installation instructions for Arduino.


The extra packages need to be downloaded and added to the library path - see [[Software installation | Arduino installation]] for ''Regbot''.
There are two files in the project for compiling (compile) and uploading (upload); these assume that the command-line tools are installed.

Latest revision as of 09:38, 1 September 2026

Back to Basebot

Development environment (IDE)

The Basebot code can be maintained in either Arduino IDE, by Microsoft Visual Studio Code, or from the command line (using any editor).

Arduino and MS Code has requirements to the file name and directory structure. The default naming follows the Arduino standard (the directory name and the ino file name must be the same).

Arduino

Install Arduino support; see Arduino and Teensy libraries

Open Arduino and select the basebot_6.ino.

Then, set the board to Teensy 4.1.

You should now be able to compile and upload the code to the robot.

Note

Editing the basebot files in the src subdirectory can not be done in the Arduino IDE, but maybe that is unnecessary.

The basebot will send data to the serial monitor. This data needs to be stored in a file for Matlab use, and another serial monitor or other tool probably has to be used.

Visual Studio Code

To use this tool, some directory structure and file names are required.

So; rename two files:

  • In the directory (where the platformio.ini resides):
    • rename the directory basebot_6 to src. (Otherwise, the code will not be found by MS Code.)
  • In this renamed directory:
    • rename basebot_6.ino to basebot_6.cpp. (Otherwise, code editor tools will be limited.)
    • Note! On Windows, this changes the file type, so it must be visible. In the File Explorer, select View > Show > File name extensions before renaming.

Install MS Visual Studio and PlatformIO; see Visual studio install

In MS-Code, open the basebot code using the PlatformIO icon :

PlatformIO -> "QUICK ACCESS" -> "PIO Home" -> "Open" and here press "Open Project"

Find the Basebot directory - it contains the platformio.ini file needed to configure the project (i.e., Teensy 4.1 and the required libraries).

Then, PlatformIO will install dependencies and check the project. If there is an error, read the error text and try to fix it.

Command line compile and upload

This is a possibility when running Linux.

Refer to the command-line installation instructions for Arduino.

There are two files in the project for compiling (compile) and uploading (upload); these assume that the command-line tools are installed.