Skip to content

Commit

Permalink
Merge pull request #35 from ubidefeo/fixRelays
Browse files Browse the repository at this point in the history
Fixed Relays
  • Loading branch information
marqdevx authored Jul 23, 2021
2 parents acff2a7 + 18289f6 commit 70134c1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/Arduino_MKRIoTCarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ int MKRIoTCarrier::begin() {
}
return false;
}

Relay1.begin();
Relay2.begin();
if(!SD.begin(SD_CS)) {
Serial.println("Sd card not detected");
}

return true;
}
11 changes: 7 additions & 4 deletions src/Arduino_MKRIoTCarrier_Relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@

#include "Arduino_MKRIoTCarrier_Relay.h"

MKRIoTCarrier_Relay::MKRIoTCarrier_Relay(int pin){
_pin = pin;
MKRIoTCarrier_Relay::MKRIoTCarrier_Relay(int pin):_pin{pin}
{
}
void MKRIoTCarrier_Relay::begin(){
pinMode(_pin ,OUTPUT);
close();

}

int MKRIoTCarrier_Relay::getPin(){
return _pin;
}
//NC state
void MKRIoTCarrier_Relay::close(){
digitalWrite(_pin , LOW);
Expand Down
6 changes: 3 additions & 3 deletions src/Arduino_MKRIoTCarrier_Relay.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
class MKRIoTCarrier_Relay{
public:
MKRIoTCarrier_Relay(int pin);

void begin();
void open();
void close();

int getPin();
int getStatus();

private:
int _pin;
const int _pin;
int _status;
};

Expand Down

0 comments on commit 70134c1

Please sign in to comment.