|
15 | 15 | }, |
16 | 16 | { |
17 | 17 | "cell_type": "code", |
18 | | - "execution_count": null, |
| 18 | + "execution_count": 3, |
19 | 19 | "id": "762d552a-dafd-4b4b-9b0c-8b6612d2415b", |
20 | 20 | "metadata": { |
21 | 21 | "scrolled": true |
22 | 22 | }, |
23 | 23 | "outputs": [], |
24 | 24 | "source": [ |
25 | 25 | "import asyncio\n", |
26 | | - "from ipymovehub import MoveHubWidget, LedColor, Port, Sensor\n", |
| 26 | + "from ipymovehub import MoveHubWidget,LedColor,Port, Sensor\n", |
27 | 27 | "from IPython.display import display\n", |
| 28 | + "from ipymovehub.movehub import MoveHubLaneProxy\n", |
28 | 29 | "\n", |
29 | 30 | "# the robot's LED supports the following colors\n", |
30 | 31 | "colors = [\n", |
|
51 | 52 | }, |
52 | 53 | { |
53 | 54 | "cell_type": "code", |
54 | | - "execution_count": null, |
| 55 | + "execution_count": 4, |
55 | 56 | "id": "aae633ad-bbb2-45c2-a1ff-5fab18146172", |
56 | 57 | "metadata": { |
57 | 58 | "scrolled": true |
|
60 | 61 | { |
61 | 62 | "data": { |
62 | 63 | "application/vnd.jupyter.widget-view+json": { |
63 | | - "model_id": "5e916fd00a0542169e70cf4eb25f3aa9", |
| 64 | + "model_id": "46dcb1855d154b0f83c51e3805c65aea", |
64 | 65 | "version_major": 2, |
65 | 66 | "version_minor": 0 |
66 | 67 | }, |
|
81 | 82 | }, |
82 | 83 | { |
83 | 84 | "cell_type": "code", |
84 | | - "execution_count": null, |
| 85 | + "execution_count": 5, |
85 | 86 | "id": "9b5f6086-3605-47ee-a170-57d3b97600e2", |
86 | 87 | "metadata": {}, |
87 | | - "outputs": [], |
| 88 | + "outputs": [ |
| 89 | + { |
| 90 | + "data": { |
| 91 | + "application/vnd.jupyter.widget-view+json": { |
| 92 | + "model_id": "c479d3e558384ef382f2660cbddd4d03", |
| 93 | + "version_major": 2, |
| 94 | + "version_minor": 0 |
| 95 | + }, |
| 96 | + "text/plain": [ |
| 97 | + "Output()" |
| 98 | + ] |
| 99 | + }, |
| 100 | + "metadata": {}, |
| 101 | + "output_type": "display_data" |
| 102 | + } |
| 103 | + ], |
88 | 104 | "source": [ |
89 | 105 | "# Case 1 : Execute this cell if there is no MoveHub connected\n", |
90 | 106 | "widget.connect()" |
|
112 | 128 | { |
113 | 129 | "data": { |
114 | 130 | "application/vnd.jupyter.widget-view+json": { |
115 | | - "model_id": "5e916fd00a0542169e70cf4eb25f3aa9", |
| 131 | + "model_id": "46dcb1855d154b0f83c51e3805c65aea", |
116 | 132 | "version_major": 2, |
117 | 133 | "version_minor": 0 |
118 | 134 | }, |
|
150 | 166 | "text": [ |
151 | 167 | "LedColor.pink\n" |
152 | 168 | ] |
153 | | - }, |
154 | | - { |
155 | | - "ename": "AttributeError", |
156 | | - "evalue": "'int' object has no attribute 'set_led_async'", |
157 | | - "output_type": "error", |
158 | | - "traceback": [ |
159 | | - "\u001b[31m---------------------------------------------------------------------------\u001b[39m", |
160 | | - "\u001b[31mAttributeError\u001b[39m Traceback (most recent call last)", |
161 | | - "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[14]\u001b[39m\u001b[32m, line 6\u001b[39m\n\u001b[32m 2\u001b[39m lane = widget.n_lanes\n\u001b[32m 3\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m color \u001b[38;5;28;01min\u001b[39;00m colors:\n\u001b[32m 4\u001b[39m print(color)\n\u001b[32m 5\u001b[39m \u001b[38;5;66;03m#log(f\"set color to {color.value}\")\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m6\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m lane.set_led_async(color)\n\u001b[32m 7\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m asyncio.sleep(\u001b[32m2\u001b[39m)\n", |
162 | | - "\u001b[31mAttributeError\u001b[39m: 'int' object has no attribute 'set_led_async'" |
163 | | - ] |
164 | 169 | } |
165 | 170 | ], |
166 | 171 | "source": [ |
|
0 commit comments