Skip to content

Commit

Permalink
Using LEADS Arduino version 1.1.0. (#319) (#320) (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC committed Jul 29, 2024
1 parent 6c6a20b commit 7529771
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
11 changes: 6 additions & 5 deletions arduino/leads_vec_power/leads_vec_power.ino
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include "LEADS.h"
#include "LEADS.h" // LEADS>=1.1.0

const int PIN_VOT[] = {A0};

VoltageSensor VOT(30000.0, 7500.0, PIN_VOT);
Peer P{};
VoltageSensor VOT{30000.0, 7500.0, ArrayList<int>(PIN_VOT)};

void setup() {
Serial.begin(9600);
VOT.initialize();
P.initializeAsRoot();
VOT.initializeAsRoot();
}

void loop() {
returnFloat(VOLTAGE_SENSOR, VOT.read());
returnFloat(P, VOLTAGE_SENSOR, VOT.read());
delay(100);
}
25 changes: 13 additions & 12 deletions arduino/leads_vec_wsc/leads_vec_wsc.ino
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
#include "LEADS.h"
#include "LEADS.h" // LEADS>=1.1.0

const int PIN_LFWSS[] = {2};
const int PIN_RFWSS[] = {3};
const int PIN_LRWSS[] = {4};
const int PIN_RRWSS[] = {5};
const int PIN_CRWSS[] = {6};

WheelSpeedSensor LFWSS(PIN_LFWSS, [](float ws) {returnFloat(LEFT_FRONT_WHEEL_SPEED_SENSOR, ws);});
WheelSpeedSensor RFWSS(PIN_RFWSS, [](float ws) {returnFloat(RIGHT_FRONT_WHEEL_SPEED_SENSOR, ws);});
WheelSpeedSensor LRWSS(PIN_LRWSS, [](float ws) {returnFloat(LEFT_REAR_WHEEL_SPEED_SENSOR, ws);});
WheelSpeedSensor RRWSS(PIN_RRWSS, [](float ws) {returnFloat(RIGHT_REAR_WHEEL_SPEED_SENSOR, ws);});
WheelSpeedSensor CRWSS(PIN_CRWSS, [](float ws) {returnFloat(CENTER_REAR_WHEEL_SPEED_SENSOR, ws);});
Peer P{};
WheelSpeedSensor LFWSS{ArrayList<int>(PIN_LFWSS), [](float ws) {returnFloat(P, LEFT_FRONT_WHEEL_SPEED_SENSOR, ws);}};
WheelSpeedSensor RFWSS{ArrayList<int>(PIN_RFWSS), [](float ws) {returnFloat(P, RIGHT_FRONT_WHEEL_SPEED_SENSOR, ws);}};
WheelSpeedSensor LRWSS{ArrayList<int>(PIN_LRWSS), [](float ws) {returnFloat(P, LEFT_REAR_WHEEL_SPEED_SENSOR, ws);}};
WheelSpeedSensor RRWSS{ArrayList<int>(PIN_RRWSS), [](float ws) {returnFloat(P, RIGHT_REAR_WHEEL_SPEED_SENSOR, ws);}};
WheelSpeedSensor CRWSS{ArrayList<int>(PIN_CRWSS), [](float ws) {returnFloat(P, CENTER_REAR_WHEEL_SPEED_SENSOR, ws);}};

void setup() {
Serial.begin(9600);
LFWSS.initialize();
RFWSS.initialize();
LRWSS.initialize();
RRWSS.initialize();
CRWSS.initialize();
P.initializeAsRoot();
LFWSS.initializeAsRoot();
RFWSS.initializeAsRoot();
LRWSS.initializeAsRoot();
RRWSS.initializeAsRoot();
CRWSS.initializeAsRoot();
}

void loop() {
Expand Down

0 comments on commit 7529771

Please sign in to comment.