Просмотр исходного кода

bugfixes plus new arduino PIN for light control

dianamaro 2 лет назад
Родитель
Сommit
99de2bab40
4 измененных файлов с 81 добавлено и 101 удалено
  1. 56 93
      aSIT.ipynb
  2. 3 3
      background.ipynb
  3. 20 3
      controllers/serial.ipynb
  4. 2 2
      postprocessing.ipynb

Разница между файлами не показана из-за своего большого размера
+ 56 - 93
aSIT.ipynb


+ 3 - 3
background.ipynb

@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 26,
+   "execution_count": 37,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -20,7 +20,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 27,
+   "execution_count": 38,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -32,7 +32,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 28,
+   "execution_count": 39,
    "metadata": {},
    "outputs": [],
    "source": [

+ 20 - 3
controllers/serial.ipynb

@@ -14,7 +14,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 4,
    "id": "4e6dfa60",
    "metadata": {},
    "outputs": [],
@@ -22,9 +22,11 @@
     "class MCSArduino(Arduino):\n",
     "    pin_diode = 13\n",
     "    pin_TTL = 6\n",
+    "    pin_LED_lights = 7\n",
     "    \n",
     "    def __init__(self, *args, **kwargs):\n",
     "        self.last_cmd = False  # False - Arduino LOW, True - Arduino HIGH\n",
+    "        self.is_light_off = False\n",
     "        super(MCSArduino, self).__init__(*args, **kwargs)\n",
     "        \n",
     "    def start_or_stop(self):\n",
@@ -32,6 +34,10 @@
     "        self.digital[MCSArduino.pin_diode].write(self.last_cmd)\n",
     "        self.digital[MCSArduino.pin_TTL].write(self.last_cmd)\n",
     "\n",
+    "    def switch_light(self):\n",
+    "        self.is_light_off = not self.is_light_off\n",
+    "        self.digital[MCSArduino.pin_LED_lights].write(self.is_light_off)\n",
+    "        \n",
     "class FakeArduino():\n",
     "    def start_or_stop(self):\n",
     "        print(\"Fake Arduino - sending a TTL pulse\")\n",
@@ -70,7 +76,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 20,
+   "execution_count": 9,
    "id": "f1050f57",
    "metadata": {},
    "outputs": [],
@@ -78,6 +84,17 @@
     "board = MCSArduino('COM10')  # Windows - 'COM10', Linux - '/dev/ttyACM0', check /dev/tty*"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": 11,
+   "id": "e8470dc1",
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# check the light on-off\n",
+    "board.switch_light()"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": 21,
@@ -93,7 +110,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 19,
+   "execution_count": 12,
    "id": "97ae6ba1",
    "metadata": {},
    "outputs": [],

+ 2 - 2
postprocessing.ipynb

@@ -13,7 +13,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": 3,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -23,7 +23,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": 4,
    "metadata": {},
    "outputs": [],
    "source": [