Ver Fonte

updated doku

subDesTagesMitExtraKaese há 4 anos atrás
pai
commit
eb1402d617
2 ficheiros alterados com 16 adições e 5 exclusões
  1. 8 1
      software/analogPressure/mcp3008.py
  2. 8 4
      software/install.md

+ 8 - 1
software/analogPressure/mcp3008.py

@@ -1,4 +1,5 @@
 from spidev import SpiDev
+import time
  
 class MCP3008:
     def __init__(self, bus = 0, device = 0):
@@ -15,4 +16,10 @@ class MCP3008:
         return data
             
     def close(self):
-        self.spi.close()
+        self.spi.close()
+
+if __name__ == "__main__":
+  adc = MCP3008(0,0)
+  while True:
+    print("Rohwerte:", [adc.read(i) for i in range(8)])
+    time.sleep(.3)

+ 8 - 4
software/install.md

@@ -152,6 +152,8 @@ $ bluetoothctl
     	Connected: no
     	LegacyPairing: yes
     	UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
+
+> quit
 ```
 Try to send a packet
 ```bash
@@ -172,14 +174,15 @@ sudo apt update
 sudo apt upgrade -y
 sudo apt autoremove
 
-sudo apt install python3-dev python3-pip
+sudo apt install python3-dev python3-pip python3-matplotlib
 
-python3 -m pip -U pip setuptools matplotlib
+python3 -m pip install -U pip setuptools
+python3 -m pip install -U matplotlib
 ```
 
-## 6.1 Install pybluez
+## 6.1 Install pybluez for python
 ```bash
-sudo apt-get install bluez bluez-tools python3-bluez
+sudo apt-get install bluez bluez-tools
 sudo apt install libbluetooth-dev
 
 python3 -m pip install wheel pybluez
@@ -205,6 +208,7 @@ Workaround: use gpio bitbang instead of spi device
 ## 6.4 Install I2C support
 ```bash
 sudo apt install python3-smbus
+python3 -m pip install smbus
 ```
 
 # 7. Fix `bluetoothd` service