-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
115 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from gpiozero import DigitalOutputDevice | ||
from gpiozero.pins.pigpio import PiGPIOFactory | ||
|
||
import serial | ||
|
||
|
||
|
||
class DigitalPiDevice: | ||
""" | ||
Digital modulated devices in combination with Raspberry Pi GPIO | ||
Setup: https://gpiozero.readthedocs.io/en/stable/remote_gpio.html | ||
""" | ||
|
||
def __init__(self, PIN, BOARD_IP: str = None): | ||
|
||
""" | ||
:param BOARD_IP: IP adress of board connected to the Device | ||
""" | ||
if BOARD_IP is not None: | ||
self._factory = PiGPIOFactory(host = BOARD_IP) | ||
self._device = DigitalOutputDevice(PIN, pin_factory = self._factory) | ||
else: | ||
self._factory = None | ||
self._device = DigitalOutputDevice(PIN) | ||
self._running = False | ||
|
||
def turn_on(self): | ||
self._device.on() | ||
self._running = True | ||
|
||
def turn_off(self): | ||
self._device.off() | ||
self._running = False | ||
|
||
def toggle(self): | ||
self._device.toggle() | ||
self._running = self._device.is_active | ||
|
||
|
||
class DigitalArduinoDevice: | ||
""" | ||
Digital modulated devices in combination with Arduino boards connected via USB | ||
setup: https://pythonforundergradengineers.com/python-arduino-LED.html | ||
""" | ||
|
||
def __init__(self, PORT): | ||
""" | ||
:param PORT: USB PORT of the arduino board | ||
""" | ||
self._device = serial.Serial(PORT, baudrate=9600) | ||
self._running = False | ||
|
||
def turn_on(self): | ||
self._device.write(b'H') | ||
self._running = True | ||
|
||
def turn_off(self): | ||
self._device.write(b'L') | ||
self._running = False | ||
|
||
def toggle(self): | ||
if self._running: | ||
self.turn_off() | ||
else: | ||
self.turn_on() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
gpiozero | ||
pigpio | ||
pyserial | ||
nidaqmx>=0.5.7 | ||
click>=7.0 | ||
opencv-python>=3.4.5.20 | ||
numpy>=1.14.5 | ||
pandas>=0.21.0 | ||
matplotlib>=3.0.3 | ||
scikit-image>=0.14.2 | ||
scipy>=1.1.0 | ||
scipy>=1.1.0 |