Browse Source

merged changes

asobolev 9 months ago
parent
commit
6400ec29e7
3 changed files with 34 additions and 6 deletions
  1. 19 0
      SIT.ipynb
  2. 13 5
      controllers/serial.ipynb
  3. 2 1
      profiles/default.json

+ 19 - 0
SIT.ipynb

@@ -44,6 +44,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -92,6 +93,20 @@
    ]
   },
   {
+   "cell_type": "code",
+   "execution_count": 4,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# check if the sound interface is there\n",
+    "import sounddevice as sd\n",
+    "asio = [x for x in sd.query_devices() if x['name'].find('ASIO') > 0]\n",
+    "#if len(asio) == 0:\n",
+    "#    raise SystemExit('The sound interface is not found. Please restart the computer')"
+   ]
+  },
+  {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -191,6 +206,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -605,6 +621,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -652,6 +669,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [
@@ -747,6 +765,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "metadata": {},
    "source": [

+ 13 - 5
controllers/serial.ipynb

@@ -76,13 +76,15 @@
     "        self.is_light_off = not self.is_light_off\n",
     "        self.digital[MCSArduino.pin_LED_lights].write(self.is_light_off)\n",
     "        \n",
-    "    def feed(self):\n",
+    "    def feed(self, n_pellets = 1):\n",
     "        self.digital[MCSArduino.pin_feeder_power].write(True)\n",
     "        time.sleep(0.5)\n",
-    "        self.digital[MCSArduino.pin_feeder].write(True)\n",
-    "        time.sleep(0.02)\n",
-    "        self.digital[MCSArduino.pin_feeder].write(False)\n",
-    "        time.sleep(1.5)\n",
+    "        for n in range(n_pellets):\n",
+    "            self.digital[MCSArduino.pin_feeder].write(True)\n",
+    "            time.sleep(0.02)\n",
+    "            self.digital[MCSArduino.pin_feeder].write(False)\n",
+    "            time.sleep(1.0)\n",
+    "        time.sleep(0.5)\n",
     "        self.digital[MCSArduino.pin_feeder_power].write(False)\n",
     "        \n",
     "        \n",
@@ -172,6 +174,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "56d33a31",
    "metadata": {},
@@ -309,6 +312,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "ff6d72c0",
    "metadata": {},
@@ -357,6 +361,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "89b10d38",
    "metadata": {},
@@ -410,6 +415,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "e6df6e15",
    "metadata": {},
@@ -576,6 +582,7 @@
    ]
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "fdb584fe",
    "metadata": {},
@@ -671,6 +678,7 @@
    "source": []
   },
   {
+   "attachments": {},
    "cell_type": "markdown",
    "id": "ae2fe188",
    "metadata": {},

+ 2 - 1
profiles/default.json

@@ -134,6 +134,7 @@
         "punishment_duration": 10,
         "distractor_islands": 1,
         "distractor_fail": false,
-        "enable_motors": false
+        "enable_motors": false,
+        "n_pellets": 1
     }
 }