From 065095fc2eea7c0c26b9f68a465f59039c5fde70 Mon Sep 17 00:00:00 2001 From: Sebastian Zug Date: Wed, 24 Jan 2024 19:13:59 +0100 Subject: [PATCH] Add simavr example --- .../MyFancyATmegaProject/.gitignore | 5 +++ .../MyFancyATmegaProject/platformio.ini | 16 +++++++ .../MyFancyATmegaProject/src/main.cpp | 44 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 exampleCode/platform.io-example/MyFancyATmegaProject/.gitignore create mode 100644 exampleCode/platform.io-example/MyFancyATmegaProject/platformio.ini create mode 100644 exampleCode/platform.io-example/MyFancyATmegaProject/src/main.cpp diff --git a/exampleCode/platform.io-example/MyFancyATmegaProject/.gitignore b/exampleCode/platform.io-example/MyFancyATmegaProject/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/exampleCode/platform.io-example/MyFancyATmegaProject/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/exampleCode/platform.io-example/MyFancyATmegaProject/platformio.ini b/exampleCode/platform.io-example/MyFancyATmegaProject/platformio.ini new file mode 100644 index 0000000..17fabc2 --- /dev/null +++ b/exampleCode/platform.io-example/MyFancyATmegaProject/platformio.ini @@ -0,0 +1,16 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:uno] +platform = atmelavr +board = uno +framework = arduino + +debug_tool = simavr \ No newline at end of file diff --git a/exampleCode/platform.io-example/MyFancyATmegaProject/src/main.cpp b/exampleCode/platform.io-example/MyFancyATmegaProject/src/main.cpp new file mode 100644 index 0000000..ab01287 --- /dev/null +++ b/exampleCode/platform.io-example/MyFancyATmegaProject/src/main.cpp @@ -0,0 +1,44 @@ +#include +#include // intxx_t und uintxx_t als Datentypen + +int main(void) +{ + uint16_t result = 0; + + // enable ADC + ADCSRA |= (1 << ADEN); + // Setting the voltage reference to Arduino Input Power + ADMUX |= (1<