Skip to content

kbrock84/c-arduino-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VS Code Setup

This config was done using Windows connected to an Ubuntu machine using the remote SSH tools. The operating system is Ubuntu Linux, but all VS Code commands are Windows.

Install following extensions:

- C/C++ (Microsoft)
- CMake (twxs)
- CMake Tools (Microsoft)
- Remote - SSH (Microsoft) if connecting to a remote Linux machine

Configure C/C++ extension (Linux)

The C/C++ extension can be configured with multiple configurations. I have a config named AVR as shown below.

Configure:

  • Open command window (Ctrl + Shift + P in Windows)
  • Select C/C++: Edit Configurations (JSON)
  • Add an AVR configuration similar to below

C/C++: Edit Configurations (JSON)

{
    "configurations": [
        {
            "name": "AVR",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/avr-gcc",
            "cStandard": "gnu11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}

Build and Flash

Open up the Makefile at the root of this repo and change the folloing values as needed. be sure to remove any extension from the file name as this MakeFile will search for ${FILENAME}.c and generate ${FILENAME}.o, ${FILENAME}.elf and ${FILENAME}.hex files.

The PORT will need to change depending on where you have your arduino plugged in.

# change these values as needed
FILENAME=blink
DEVICE=atmega328p
PORT=/dev/ttyACM0

To build and flash, open up the integrated terminal in VS Code using key combo Ctrl + `

Run the make command

sudo make

About

A template for writing and programming C for arduino uno in Linux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published