Skip to content

Commit 51a9a0a

Browse files
committed
Adding code examples for MOSFET driver
Adding simple blink style examples for MOSFET driver
1 parent 778755a commit 51a9a0a

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-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)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
const int driverPin = 3;
6+
7+
void setup() {
8+
Serial.begin(115200);
9+
Serial.println("Basic MOSFET Driver Test");
10+
pinMode(driverPin, OUTPUT);
11+
}
12+
13+
void loop() {
14+
digitalWrite(driverPin, HIGH);
15+
Serial.println("The MOSFET driver is triggered.");
16+
delay(1000);
17+
digitalWrite(driverPin, LOW);
18+
Serial.println("The MOSFET driver is not triggered.");
19+
delay(1000);
20+
}

0 commit comments

Comments
 (0)