subDesTagesMitExtraKaese преди 4 години
родител
ревизия
06b118b049

+ 18 - 0
software/analogPressure/mcp3008.py

@@ -0,0 +1,18 @@
+from spidev import SpiDev
+ 
+class MCP3008:
+    def __init__(self, bus = 0, device = 0):
+        self.bus, self.device = bus, device
+        self.spi = SpiDev()
+        self.open()
+ 
+    def open(self):
+        self.spi.open(self.bus, self.device)
+    
+    def read(self, channel = 0):
+        adc = self.spi.xfer2([1, (8 + channel) << 4, 0])
+        data = ((adc[1] & 3) << 8) + adc[2]
+        return data
+            
+    def close(self):
+        self.spi.close()

+ 16 - 0
software/analogPressure/sdpArray.py

@@ -0,0 +1,16 @@
+from MCP3008 import MCP3008
+
+class SdpArray():
+  __init__(self):
+    self.adcs = (
+      MCP3008(0, 0), 
+      MCP3008(0, 1)
+    )
+
+  read(self, channel):
+    if channel < 8:
+      value = adc[0].read(channel) 
+    else:
+      value = adc[1].read(channel-8)
+
+    print("Anliegende Spannung: %.2f" % (value / 1023.0 * 3.3) )

+ 0 - 0
software/spd610/sdp610.ino → software/digitalPressure/sdp610.ino


+ 0 - 0
software/spd610/spd610.py → software/digitalPressure/sdp610.py


+ 28 - 2
software/install.md

@@ -1,6 +1,6 @@
 # Installation
 
-## PyQt5 [Tutorial](https://likegeeks.com/pyqt5-tutorial/)
+## Python 3
 
 on Ubuntu / Debian
 
@@ -8,12 +8,37 @@ on Ubuntu / Debian
 sudo apt update
 sudo apt upgrade -y
 sudo apt install python3 python3-pip
+python3 -m pip -U pip setuptools
+```
+
+## PyQt5 [Tutorial](https://likegeeks.com/pyqt5-tutorial/)
+
+``` bash
 python3 -m pip install PyQt5 PyQt5-tools
 ```
 
+## Bluetooth for Python
+
+on Ubuntu / Debian
+
+``` bash
+sudo apt-get install bluez bluez-utils python3-bluez
+```
+
+## SPI for Python
+
+Install https://github.com/doceme/py-spidev
+
 ## Modifying UI with PyQt5 designer
 
-Location of PyQt5 designer on Windows
+on Ubuntu / Debian
+
+``` bash
+sudo apt install qt4-designer
+designer-qt4
+```
+
+Location of PyQt5 designer.exe on Windows
 > C:\Program Files\Python36\Lib\site-packages\pyqt5-tools\
 
 or
@@ -37,5 +62,6 @@ pyuic5 youruifile -o yourpyfile -x
 ## Running
 
 ```bash
+cd software/
 python3 main.py
 ```

+ 3 - 0
software/run.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+python3 main.py

+ 6 - 0
software/ui/build.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+cd "$(dirname "$0")"
+
+make clean
+make

+ 0 - 9
software/ui/main.py

@@ -1,9 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'ui\main.ui'
-#
-# Created by: PyQt5 UI code generator 5.14.1
-#
-# WARNING! All changes made in this file will be lost!
-
-

+ 3 - 4
software/ui/main_ui.py

@@ -1,15 +1,13 @@
 # -*- coding: utf-8 -*-
 
-# Form implementation generated from reading ui file 'ui\main_ui.ui'
+# Form implementation generated from reading ui file 'main_ui.ui'
 #
-# Created by: PyQt5 UI code generator 5.14.1
+# Created by: PyQt5 UI code generator 5.11.3
 #
 # WARNING! All changes made in this file will be lost!
 
-
 from PyQt5 import QtCore, QtGui, QtWidgets
 
-
 class Ui_MainWindow(object):
     def setupUi(self, MainWindow):
         MainWindow.setObjectName("MainWindow")
@@ -50,3 +48,4 @@ class Ui_MainWindow(object):
         self.menuFile.setTitle(_translate("MainWindow", "File"))
         self.menuEdit.setTitle(_translate("MainWindow", "Edit"))
         self.menuView.setTitle(_translate("MainWindow", "View"))
+

+ 12 - 0
software/ui/makefile

@@ -0,0 +1,12 @@
+UIFILES := $(wildcard *.ui)
+PYFILES := $(UIFILES:.ui=.py)    
+
+CC = python3 -m PyQt5.uic.pyuic
+
+all: $(PYFILES)
+
+%.py: %.ui
+	$(CC) -o $@ $< 
+
+clean:
+	rm $(PYFILES)

+ 20 - 0
software/wirelessLoadCell/GSV4-BT.py

@@ -0,0 +1,20 @@
+
+
+
+# simple inquiry example
+import bluetooth
+
+nearby_devices = bluetooth.discover_devices(lookup_names=True)
+print("Found {} devices.".format(len(nearby_devices)))
+
+for addr, name in nearby_devices:
+  print("  {} - {}".format(addr, name))
+
+
+class GSV4-BT():
+  __init__(self):
+
+    pass
+
+  scan(self):
+