diff --git a/README.md b/README.md
index 246f078..f736046 100644
--- a/README.md
+++ b/README.md
@@ -33,22 +33,10 @@ For free dashboard downloads go to https://tunerstudiodashboards.com/ (you will
## **Arduino Setup**
-After the dashboard is setup how you like, the fun starts. I utilized a arduino to communicate with the Pi and TS Dash to pass sensor data. The ```.ino``` file in this repo contains all the code to add the Arduino Mega. I will try to keep this file updated with suggestions from users or with additions I find useful
+After the dashboard is setup how you like, the fun starts. I utilized a arduino to communicate with the Pi and TS Dash to pass sensor data. The ```digital-dash-arduino``` platformio project in this repo contains all the code to add the Arduino Mega. I will try to keep this file updated with suggestions from users or with additions I find useful
-To upload the ```.ino``` to the arduino you will need the ArduinoIDE(https://www.arduino.cc/en/software/) and to download it to a separate machine(not needed on the Pi)
-
-
-Once you have the arduinoIDE installed and open on your machine, open the ```.ino``` in the IDE.
-
-
-Connect your Arduino Mega via usb and select the proper USB/location of the Arduino at the top right of the IDE.
-
-
-Press the right arrow button in the upper right(upload) to transfer the ```.ino``` to the arduino.
-
-
-Wait for it to say "Done uploading" at the bottom and then you can unplug the arduino.
+Please follow the instrustions in the [README.md file in digital-dash-arduino](digital-dash-arduino/README.md)
After that you just need to wire the sensors to the arduino. My youtube video goes over that in depth, but basically you need to utilize sensors that already exist on your vehicle or purchase new ones solely for this purpose.
diff --git a/Raspberry Pi IMGs/pi5-travis.cea-digital-dash.img.xz b/Raspberry Pi IMGs/pi5-travis.cea-digital-dash.img.xz
deleted file mode 100644
index 6d085e6..0000000
--- a/Raspberry Pi IMGs/pi5-travis.cea-digital-dash.img.xz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e1853ba958827e3dcbd6ce34989124ccc0f07e9dc916776eb331de3dabdd9855
-size 852627312
diff --git a/digital-dash-arduino/.gitignore b/digital-dash-arduino/.gitignore
new file mode 100644
index 0000000..89cc49c
--- /dev/null
+++ b/digital-dash-arduino/.gitignore
@@ -0,0 +1,5 @@
+.pio
+.vscode/.browse.c_cpp.db*
+.vscode/c_cpp_properties.json
+.vscode/launch.json
+.vscode/ipch
diff --git a/digital-dash-arduino/.vscode/extensions.json b/digital-dash-arduino/.vscode/extensions.json
new file mode 100644
index 0000000..29203a4
--- /dev/null
+++ b/digital-dash-arduino/.vscode/extensions.json
@@ -0,0 +1,8 @@
+{
+ "recommendations": [
+ "pioarduino.pioarduino-ide"
+ ],
+ "unwantedRecommendations": [
+ "ms-vscode.cpptools-extension-pack"
+ ]
+}
diff --git a/CANBUS/CANBUS_Communication_Setup.md b/digital-dash-arduino/CANBUS_Communication_Setup.md
similarity index 75%
rename from CANBUS/CANBUS_Communication_Setup.md
rename to digital-dash-arduino/CANBUS_Communication_Setup.md
index 286bce3..e500c70 100644
--- a/CANBUS/CANBUS_Communication_Setup.md
+++ b/digital-dash-arduino/CANBUS_Communication_Setup.md
@@ -11,13 +11,7 @@ It will be up to you to determine, based off TimeStamps, IDs, and Data, what eac
## Adding MCP2515 to Arduino to access CANBUS ##
This effectively makes the Arduino a CANBUS node
-The specific INO file for HALTECHs or other standalones which is in the project will need to be uploaded to the Arduino via Arduino IDE
-
-In the IDE, the appropriate library needs to be installed so that the ino file(referenced above) has access to it.
-Do this by:
-- Going to the top and clikcing: ```Sketch → Include Library → Manage Libraries```
-- Search for ```MCP_CAN```
-- This the libary the CANBUS ino's use ```#include ```
+The build flag 'CAN_ENABLED' in platformio.ini for HALTECHs or other standalones which is in the project will need to be uploaded to the Arduino via platformio in vscode
## Part needed: ##
diff --git a/NON-CANBUS/ANALOG/Misc_Sensor_Wiring.md b/digital-dash-arduino/Misc_Sensor_Wiring.md
similarity index 100%
rename from NON-CANBUS/ANALOG/Misc_Sensor_Wiring.md
rename to digital-dash-arduino/Misc_Sensor_Wiring.md
diff --git a/digital-dash-arduino/README.md b/digital-dash-arduino/README.md
new file mode 100644
index 0000000..0b7789e
--- /dev/null
+++ b/digital-dash-arduino/README.md
@@ -0,0 +1,15 @@
+# Arduino MEGA 2560 project setup #
+
+1. Install [visual studio code](https://code.visualstudio.com/Download)
+2. Install the platformio extension
+ * Open VSCode Package Manager
+ * Search for the official platformio ide extension
+ * Install PlatformIO IDE.
+
+3. Double click `digital-dash-arduino.code-workspace` to open the project
+ * platformio will automatically download and install the dependencies required for the project
+
+4. Open the file `platformio.ini` and configure the project
+ * If you need CAN enabled, uncomment the line for CAN
+
+5. Plug in your mega 2560 and click the button in the right to upload the code
diff --git a/digital-dash-arduino/digital-dash-arduino.code-workspace b/digital-dash-arduino/digital-dash-arduino.code-workspace
new file mode 100644
index 0000000..876a149
--- /dev/null
+++ b/digital-dash-arduino/digital-dash-arduino.code-workspace
@@ -0,0 +1,8 @@
+{
+ "folders": [
+ {
+ "path": "."
+ }
+ ],
+ "settings": {}
+}
\ No newline at end of file
diff --git a/digital-dash-arduino/include/README b/digital-dash-arduino/include/README
new file mode 100644
index 0000000..49819c0
--- /dev/null
+++ b/digital-dash-arduino/include/README
@@ -0,0 +1,37 @@
+
+This directory is intended for project header files.
+
+A header file is a file containing C declarations and macro definitions
+to be shared between several project source files. You request the use of a
+header file in your project source file (C, C++, etc) located in `src` folder
+by including it, with the C preprocessing directive `#include'.
+
+```src/main.c
+
+#include "header.h"
+
+int main (void)
+{
+ ...
+}
+```
+
+Including a header file produces the same results as copying the header file
+into each source file that needs it. Such copying would be time-consuming
+and error-prone. With a header file, the related declarations appear
+in only one place. If they need to be changed, they can be changed in one
+place, and programs that include the header file will automatically use the
+new version when next recompiled. The header file eliminates the labor of
+finding and changing all the copies as well as the risk that a failure to
+find one copy will result in inconsistencies within a program.
+
+In C, the convention is to give header files names that end with `.h'.
+
+Read more about using header files in official GCC documentation:
+
+* Include Syntax
+* Include Operation
+* Once-Only Headers
+* Computed Includes
+
+https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
diff --git a/digital-dash-arduino/lib/README b/digital-dash-arduino/lib/README
new file mode 100644
index 0000000..9379397
--- /dev/null
+++ b/digital-dash-arduino/lib/README
@@ -0,0 +1,46 @@
+
+This directory is intended for project specific (private) libraries.
+PlatformIO will compile them to static libraries and link into the executable file.
+
+The source code of each library should be placed in a separate directory
+("lib/your_library_name/[Code]").
+
+For example, see the structure of the following example libraries `Foo` and `Bar`:
+
+|--lib
+| |
+| |--Bar
+| | |--docs
+| | |--examples
+| | |--src
+| | |- Bar.c
+| | |- Bar.h
+| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
+| |
+| |--Foo
+| | |- Foo.c
+| | |- Foo.h
+| |
+| |- README --> THIS FILE
+|
+|- platformio.ini
+|--src
+ |- main.c
+
+Example contents of `src/main.c` using Foo and Bar:
+```
+#include
+#include
+
+int main (void)
+{
+ ...
+}
+
+```
+
+The PlatformIO Library Dependency Finder will find automatically dependent
+libraries by scanning project source files.
+
+More information about PlatformIO Library Dependency Finder
+- https://docs.platformio.org/page/librarymanager/ldf.html
diff --git a/digital-dash-arduino/platformio.ini b/digital-dash-arduino/platformio.ini
new file mode 100644
index 0000000..1bcc654
--- /dev/null
+++ b/digital-dash-arduino/platformio.ini
@@ -0,0 +1,21 @@
+; 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:megaatmega2560]
+platform = atmelavr
+board = megaatmega2560
+framework = arduino
+; upload_speed = 115200
+
+build_flags =
+; Note: Uncomment the following line to enable CAN bus support
+; -D CAN_ENABLED
+lib_deps =
+ coryjfowler/mcp_can@^1.5.1
\ No newline at end of file
diff --git a/CANBUS/Haltech_To_Arduino_DRAFT.ino b/digital-dash-arduino/src/Haltech_To_Arduino_DRAFT.cpp
similarity index 99%
rename from CANBUS/Haltech_To_Arduino_DRAFT.ino
rename to digital-dash-arduino/src/Haltech_To_Arduino_DRAFT.cpp
index 0e1857f..d4a191a 100644
--- a/CANBUS/Haltech_To_Arduino_DRAFT.ino
+++ b/digital-dash-arduino/src/Haltech_To_Arduino_DRAFT.cpp
@@ -1,3 +1,4 @@
+#ifdef CAN_ENABLED
// =======================================================
// Travis Digital Dash – Haltech CAN → TS Dash Serial Bridge
// Arduino Mega 2560 + MCP2515 (16MHz) @ 500kbps
@@ -302,3 +303,4 @@ void loop() {
handleSerialByte((uint8_t)Serial.read());
}
}
+#endif
\ No newline at end of file
diff --git a/NON-CANBUS/ANALOG/travis.cea_Digital_Dash.ino b/digital-dash-arduino/src/travis.cea_Digital_Dash.cpp
similarity index 99%
rename from NON-CANBUS/ANALOG/travis.cea_Digital_Dash.ino
rename to digital-dash-arduino/src/travis.cea_Digital_Dash.cpp
index 3d40926..c57a6fe 100644
--- a/NON-CANBUS/ANALOG/travis.cea_Digital_Dash.ino
+++ b/digital-dash-arduino/src/travis.cea_Digital_Dash.cpp
@@ -1,3 +1,4 @@
+#ifndef CAN_ENABLED
// =======================================================
// Travis Digital Dash – TunerStudio Interface
// FINAL PRODUCTION BUILD + BATT VOLTAGE
@@ -248,6 +249,7 @@ static inline uint8_t clampU8(int v){
return v;
}
+float readAdcFiltered(int pin, float &ema, uint8_t samples, uint8_t trim, float alpha);
uint16_t readBatteryVoltage_x10(float &ema) {
float adc = readAdcFiltered(BATT_VOLTAGE_PIN, ema, 8, 1, EMA_ALPHA_SLOW);
float vAdc = adc * (VREF / ADC_MAX);
@@ -895,3 +897,4 @@ void loop(){
else if (c == 'd') { readU16LE(); uint32_t crc=0; Serial.write((uint8_t*)&crc,4); }
}
}
+#endif
\ No newline at end of file
diff --git a/digital-dash-arduino/test/README b/digital-dash-arduino/test/README
new file mode 100644
index 0000000..9b1e87b
--- /dev/null
+++ b/digital-dash-arduino/test/README
@@ -0,0 +1,11 @@
+
+This directory is intended for PlatformIO Test Runner and project tests.
+
+Unit Testing is a software testing method by which individual units of
+source code, sets of one or more MCU program modules together with associated
+control data, usage procedures, and operating procedures, are tested to
+determine whether they are fit for use. Unit testing finds problems early
+in the development cycle.
+
+More information about PlatformIO Unit Testing:
+- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html