From 3a973387306aea3004859c196c9de35ed2afdfc6 Mon Sep 17 00:00:00 2001 From: jakeg00dwin Date: Tue, 3 Sep 2024 19:12:15 -0700 Subject: [PATCH] Confirmed that Relay2 setup is correct. --- src/main.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 9527664..75d5045 100644 --- a/src/main.c +++ b/src/main.c @@ -50,6 +50,17 @@ void setup_relays(Relay *arr) { PORTA.DIR |= (1 << RELAY0_ENPIN); PORTA.DIR &= ~(1 << RELAY0_INPIN); + + // setup the second relay + arr[1].output_port = &PORTB.OUT; + arr[1].output_pin = RELAY1_ENPIN; + arr[1].input_port = &PORTA.IN; + arr[1].input_pin = RELAY1_INPIN; + arr[1].disabled_fpc = false; + + // Set the directions for the input and output pins/ports + PORTB.DIR |= (1 << RELAY1_ENPIN); + PORTA.DIR &= ~(1 << RELAY0_INPIN); //for (int i = 0; i < N_RELAYS; i++) { //Relay_MeasureMakeTime(&arr[0]); @@ -65,9 +76,9 @@ int main(int argc, char **argv) { Relay relay_array[N_RELAYS]; setup_relays(relay_array); - Relay_MeasureMakeTime(&relay_array[0]); + Relay_MeasureMakeTime(&relay_array[1]); _delay_ms(500); - Relay_MeasureBreakTime(&relay_array[0]); + Relay_MeasureBreakTime(&relay_array[1]); // Setup for Infinite Loop