Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/arduino-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Arduino Examples CI

on:
push:
paths-ignore:
- '**.md'
pull_request:

jobs:
compile-examples:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
board:
- name: "Arduino Uno"
fqbn: "arduino:avr:uno"
platform: "arduino:avr"
- name: "ESP32 Dev Module"
fqbn: "esp32:esp32:esp32"
platform: "esp32:esp32"

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Arduino CLI
uses: arduino/setup-arduino-cli@v1

- name: Configure ESP32 Board Manager
if: matrix.board.platform == 'esp32:esp32'
run: |
arduino-cli config init
arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

- name: Install Board Platform
run: |
arduino-cli core update-index
arduino-cli core install ${{ matrix.board.platform }}

- name: Install AVR Dependencies
if: matrix.board.platform == 'arduino:avr'
run: |
arduino-cli lib install "AltSoftSerial"

- name: Compile Library Examples
run: |
# Setup local library link
mkdir -p $HOME/Arduino/libraries
ln -s $GITHUB_WORKSPACE $HOME/Arduino/libraries/OBD2_KLine

# Find and compile each .ino file
find examples -name "*.ino" -print0 | while IFS= read -r -d '' ino_file; do
sketch_dir=$(dirname "$ino_file")
echo "------------------------------------------------"
echo "Processing: $sketch_dir"
echo "Board: ${{ matrix.board.name }}"
arduino-cli compile --fqbn ${{ matrix.board.fqbn }} --library . "$sketch_dir"
if [ $? -ne 0 ]; then
echo "Compilation failed for $sketch_dir"
exit 1
fi
done

- name: Summary
run: echo "All examples compiled successfully for ${{ matrix.board.name }}."
12 changes: 8 additions & 4 deletions examples/Car Specific/Honda/Honda.ino
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#include "OBD2_KLine.h" // Include the library for OBD2 K-Line communication
#include "Honda_CR-V_2003.h"
// #include <AltSoftSerial.h> // Optional alternative software serial (not used here)
// AltSoftSerial Alt_Serial; // Create an alternative serial object (commented out)

// ---------------- Create an OBD2_KLine object for communication.
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__)
#include <AltSoftSerial.h>
AltSoftSerial Alt_Serial;
OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#elif defined(ESP32)
OBD2_KLine KLine(Serial1, 10400, 10, 11); // Uses Hardware Serial (Serial1) at 10400 baud, with RX on pin 10 and TX on pin 11.
//OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#else
#error "Unsupported board! This library currently supports Arduino Uno, Nano, Mega, and ESP32. Please select a compatible board in your IDE."
#endif

void setup() {
Serial.begin(115200); // Start the default serial (for logging/debugging)
Expand Down
12 changes: 8 additions & 4 deletions examples/Car Specific/Opel/Opel.ino
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#include "OBD2_KLine.h" // Include the library for OBD2 K-Line communication
#include "Opel_Vectra_B_2001_Codes.h"
//#include <AltSoftSerial.h> // Optional alternative software serial (not used here)
//AltSoftSerial Alt_Serial; // Create an alternative serial object (commented out)

// ---------------- Create an OBD2_KLine object for communication.
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__)
#include <AltSoftSerial.h>
AltSoftSerial Alt_Serial;
OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#elif defined(ESP32)
OBD2_KLine KLine(Serial1, 10400, 10, 11); // Uses Hardware Serial (Serial1) at 10400 baud, with RX on pin 10 and TX on pin 11.
//OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#else
#error "Unsupported board! This library currently supports Arduino Uno, Nano, Mega, and ESP32. Please select a compatible board in your IDE."
#endif

bool connectionStatus = false;
int kw81_Stage = 0;
Expand Down
20 changes: 12 additions & 8 deletions examples/Car Specific/Yamaha/Yamaha.ino
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#include "OBD2_KLine.h" // Include the library for OBD2 K-Line communication
#include "Yamaha_F70.h"
//#include <AltSoftSerial.h> // Optional alternative software serial (not used here)
//AltSoftSerial Alt_Serial; // Create an alternative serial object (commented out)

// ---------------- Create an OBD2_KLine object for communication.
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__)
#include <AltSoftSerial.h>
AltSoftSerial Alt_Serial;
OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#elif defined(ESP32)
OBD2_KLine KLine(Serial1, 10400, 10, 11); // Uses Hardware Serial (Serial1) at 10400 baud, with RX on pin 10 and TX on pin 11.
//OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#else
#error "Unsupported board! This library currently supports Arduino Uno, Nano, Mega, and ESP32. Please select a compatible board in your IDE."
#endif

int counter1 = 0;

Expand All @@ -32,14 +36,14 @@ void Yamaha_Simulator() {
// delay(300);
// writeRawData(yamahaEngineNO_Response, sizeof(yamahaEngineNO_Response), 0);
}
if (KLine.resultBuffer[0] == 0xE5) {
//delay(100);
KLine.writeRawData(yamahaLiveData1_Response, sizeof(yamahaLiveData1_Response), 0);
// if (KLine.resultBuffer[0] == 0xE5) {
// delay(100);
// KLine.writeRawData(yamahaLiveData1_Response, sizeof(yamahaLiveData1_Response), 0);
// counter1++;
// if (counter1 == 2) {
// delay(10);
// writeRawData(yamahaInit_Response2, sizeof(yamahaInit_Response2), 0);
// }
}
// }
}
}
14 changes: 9 additions & 5 deletions examples/OBD2 Standard/ClearDTC/ClearDTC.ino
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include "OBD2_KLine.h" // Include the library for OBD2 K-Line communication
// #include <AltSoftSerial.h> // Optional alternative software serial (not used here)
// AltSoftSerial Alt_Serial; // Create an alternative serial object (commented out)

// ---------------- Create an OBD2_KLine object for communication.
OBD2_KLine KLine(Serial1, 10400, 10, 11); // Uses Hardware Serial (Serial1) at 10400 baud, with RX on pin 10 and TX on pin 11.
// OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__)
#include <AltSoftSerial.h>
AltSoftSerial Alt_Serial;
OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#elif defined(ESP32)
OBD2_KLine KLine(Serial1, 10400, 10, 11); // Uses Hardware Serial (Serial1) at 10400 baud, with RX on pin 10 and TX on pin 11.
#else
#error "Unsupported board! This library currently supports Arduino Uno, Nano, Mega, and ESP32. Please select a compatible board in your IDE."
#endif

void setup() {
Serial.begin(115200); // Start the default serial (for logging/debugging)
Expand Down
12 changes: 8 additions & 4 deletions examples/OBD2 Standard/GetFreezeFrame/GetFreezeFrame.ino
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include "OBD2_KLine.h" // Include the library for OBD2 K-Line communication
//#include <AltSoftSerial.h> // Optional alternative software serial (not used here)
//AltSoftSerial Alt_Serial; // Create an alternative serial object (commented out)

// ---------------- Create an OBD2_KLine object for communication.
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__)
#include <AltSoftSerial.h>
AltSoftSerial Alt_Serial;
OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#elif defined(ESP32)
OBD2_KLine KLine(Serial1, 10400, 10, 11); // Uses Hardware Serial (Serial1) at 10400 baud, with RX on pin 10 and TX on pin 11.
//OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#else
#error "Unsupported board! This library currently supports Arduino Uno, Nano, Mega, and ESP32. Please select a compatible board in your IDE."
#endif

void setup() {
Serial.begin(115200); // Start the default serial (for logging/debugging)
Expand Down
12 changes: 8 additions & 4 deletions examples/OBD2 Standard/GetLiveData/GetLiveData.ino
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include "OBD2_KLine.h" // Include the library for OBD2 K-Line communication
//#include <AltSoftSerial.h> // Optional alternative software serial (not used here)
//AltSoftSerial Alt_Serial; // Create an alternative serial object (commented out)

// ---------------- Create an OBD2_KLine object for communication.
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__)
#include <AltSoftSerial.h>
AltSoftSerial Alt_Serial;
OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#elif defined(ESP32)
OBD2_KLine KLine(Serial1, 10400, 10, 11); // Uses Hardware Serial (Serial1) at 10400 baud, with RX on pin 10 and TX on pin 11.
//OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#else
#error "Unsupported board! This library currently supports Arduino Uno, Nano, Mega, and ESP32. Please select a compatible board in your IDE."
#endif

void setup() {
Serial.begin(115200); // Start the default serial (for logging/debugging)
Expand Down
12 changes: 8 additions & 4 deletions examples/OBD2 Standard/GetSupportedPIDs/GetSupportedPIDs.ino
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include "OBD2_KLine.h" // Include the library for OBD2 K-Line communication
// #include <AltSoftSerial.h> // Optional alternative software serial (not used here)
// AltSoftSerial Alt_Serial; // Create an alternative serial object (commented out)

// ---------------- Create an OBD2_KLine object for communication.
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__)
#include <AltSoftSerial.h>
AltSoftSerial Alt_Serial;
OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#elif defined(ESP32)
OBD2_KLine KLine(Serial1, 10400, 10, 11); // Uses Hardware Serial (Serial1) at 10400 baud, with RX on pin 10 and TX on pin 11.
// OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#else
#error "Unsupported board! This library currently supports Arduino Uno, Nano, Mega, and ESP32. Please select a compatible board in your IDE."
#endif

void setup() {
Serial.begin(115200); // Start the default serial (for logging/debugging)
Expand Down
12 changes: 8 additions & 4 deletions examples/OBD2 Standard/GetVehicleInfo/GetVehicleInfo.ino
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include "OBD2_KLine.h" // Include the library for OBD2 K-Line communication
// #include <AltSoftSerial.h> // Optional alternative software serial (not used here)
// AltSoftSerial Alt_Serial; // Create an alternative serial object (commented out)

// ---------------- Create an OBD2_KLine object for communication.
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__)
#include <AltSoftSerial.h>
AltSoftSerial Alt_Serial;
OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#elif defined(ESP32)
OBD2_KLine KLine(Serial1, 10400, 10, 11); // Uses Hardware Serial (Serial1) at 10400 baud, with RX on pin 10 and TX on pin 11.
// OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#else
#error "Unsupported board! This library currently supports Arduino Uno, Nano, Mega, and ESP32. Please select a compatible board in your IDE."
#endif

void setup() {
Serial.begin(115200); // Start the default serial (for logging/debugging)
Expand Down
12 changes: 8 additions & 4 deletions examples/OBD2 Standard/ReadDTC/ReadDTC.ino
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#include "OBD2_KLine.h" // Include the library for OBD2 K-Line communication
// #include <AltSoftSerial.h> // Optional alternative software serial (not used here)
// AltSoftSerial Alt_Serial; // Create an alternative serial object (commented out)

// ---------------- Create an OBD2_KLine object for communication.
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__)
#include <AltSoftSerial.h>
AltSoftSerial Alt_Serial;
OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#elif defined(ESP32)
OBD2_KLine KLine(Serial1, 10400, 10, 11); // Uses Hardware Serial (Serial1) at 10400 baud, with RX on pin 10 and TX on pin 11.
// OBD2_KLine KLine(Alt_Serial, 10400, 8, 9); // Uses AltSoftSerial at 10400 baud, with RX on pin 8 and TX on pin 9.
#else
#error "Unsupported board! This library currently supports Arduino Uno, Nano, Mega, and ESP32. Please select a compatible board in your IDE."
#endif

void setup() {
Serial.begin(115200); // Start the default serial (for logging/debugging)
Expand Down