Skip to content

Commit

Permalink
Merge pull request #14 from KylieModen/patch-1
Browse files Browse the repository at this point in the history
Add isConnected() Function
  • Loading branch information
JohnVidler authored Jun 14, 2022
2 parents 48e2115 + 49d0ef4 commit b46496d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions client/MBFirmataClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ class MicrobitFirmataClient {
return null;
})
}

isConnected() {
// Return true or false if port connected

if (this.myPort) {
console.log("Is Connected True", this.myPort.path);
return true;
} else {
console.log("Is Connected False", this.myPort.path);
return false;
}
}

disconnect() {
// Close and discard the serial port.
Expand Down

0 comments on commit b46496d

Please sign in to comment.