From a762e8ae24fc254b547d58fcc889444f60688e44 Mon Sep 17 00:00:00 2001 From: E Thomas Date: Sun, 25 Mar 2018 20:36:54 -0400 Subject: [PATCH] Add NODE_NUMBER define --- doc/Hardware and Software Setup Instructions.md | 8 +++----- src/delta5node/delta5node.ino | 7 +++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/Hardware and Software Setup Instructions.md b/doc/Hardware and Software Setup Instructions.md index 5cdf458..2a722e1 100644 --- a/doc/Hardware and Software Setup Instructions.md +++ b/doc/Hardware and Software Setup Instructions.md @@ -56,12 +56,10 @@ Note: The latest Arduino IDE (1.8+) is required from https://www.arduino.cc/en/M Open '/delta5_race_timer/src/delta5node/delta5node.ino' in the Arduino IDE. -Configure the '#define i2cSlaveAddress' line of the .ino for each node before uploading. +Configure the '#define NODE_NUMBER' line of the .ino for each node before uploading. For first node set NODE_NUMBER to 1, for second set it to 2, etc. ``` -// Node Setup -- Set the i2c address here -// Node 1 = 8, Node 2 = 10, Node 3 = 12, Node 4 = 14 -// Node 5 = 16, Node 6 = 18, Node 7 = 20, Node 8 = 22 -#define i2cSlaveAddress 8 +// Node Setup -- Set node number here (1 - 8) +#define NODE_NUMBER 1 ``` ### System (Raspberry Pi) diff --git a/src/delta5node/delta5node.ino b/src/delta5node/delta5node.ino index c2e15ab..0acead4 100644 --- a/src/delta5node/delta5node.ino +++ b/src/delta5node/delta5node.ino @@ -26,10 +26,13 @@ #include -// Node Setup -- Set the i2c address here +// Node Setup -- Set node number here (1 - 8) +#define NODE_NUMBER 1 + +// i2c address for node // Node 1 = 8, Node 2 = 10, Node 3 = 12, Node 4 = 14 // Node 5 = 16, Node 6 = 18, Node 7 = 20, Node 8 = 22 -#define i2cSlaveAddress 8 +#define i2cSlaveAddress (6 + (NODE_NUMBER * 2)) const int slaveSelectPin = 10; // Setup data pins for rx5808 comms const int spiDataPin = 11;