Skip to content

Commit 933d03c

Browse files
authored
Merge pull request #2354 from adafruit/mosfet_driver
Adding code examples for MOSFET driver
2 parents 778755a + be1886f commit 933d03c

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
import time
6+
import board
7+
from digitalio import DigitalInOut, Direction
8+
9+
# motor output
10+
solenoid = DigitalInOut(board.D5)
11+
solenoid.direction = Direction.OUTPUT
12+
13+
while True:
14+
solenoid.value = False
15+
print("The motor is not triggered.")
16+
time.sleep(1)
17+
solenoid.value = True
18+
print("The motor is triggered.")
19+
time.sleep(1)

MOSFET_Driver_Examples/MOSFET_Driver_Blink/.uno.test.only

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
#define driverPin 3
6+
7+
void setup() {
8+
while (!Serial);
9+
delay(1000);
10+
Serial.begin(115200);
11+
Serial.println("Basic MOSFET Driver Test");
12+
pinMode(driverPin, OUTPUT);
13+
}
14+
15+
void loop() {
16+
17+
digitalWrite(driverPin, HIGH);
18+
Serial.println("The MOSFET driver is triggered.");
19+
delay(1000);
20+
digitalWrite(driverPin, LOW);
21+
Serial.println("The MOSFET driver is not triggered.");
22+
delay(1000);
23+
}

0 commit comments

Comments
 (0)