Files
jupyter_micropython_kernel/Maixpy_demo.ipynb
2019-01-17 16:29:54 +00:00

127 lines
2.4 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[34mConnecting to --port=/dev/ttyUSB1 --baud=115200 \u001b[0m\n",
"\u001b[34mReady.\n",
"\u001b[0m"
]
}
],
"source": [
"%serialconnect"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Enter the ov2640_init\n",
"[MAIXPY]LCD:init\n"
]
}
],
"source": [
"\n",
"import machine\n",
"c = machine.ov2640()\n",
"c.init()\n",
"l = machine.st7789()\n",
"l.init()\n",
"i = bytearray(320*240*2)\n",
"\n",
"c.get_image(i)\n",
"l.draw_picture_default(i)\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"."
]
}
],
"source": [
"for j in range(50):\n",
" c.get_image(i)\n",
" l.draw_picture_default(i)\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[leftinbuffer] ['\\x04\\x04>']\n",
"GC: total: 1040384, used: 413728, free: 626656\n",
" No. of 1-blocks: 48, 2-blocks: 10, max blk sz: 12657, max free sz: 9014\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Traceback (most recent call last):\n",
" File \"<stdin>\", line 4, in <module>\n",
"MemoryError: memory allocation failed, allocating 405300 bytes\n"
]
}
],
"source": [
"for j in range(30):\n",
" c.get_image(i)\n",
" for x in range(100,120):\n",
" i[x*320*2 + 100:x*320*2 + 200] = b'0x99'*100\n",
" l.draw_picture_default(i)\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "MicroPython - USB",
"language": "micropython",
"name": "micropython"
},
"language_info": {
"codemirror_mode": "python",
"file_extension": ".py",
"mimetype": "text/python",
"name": "micropython"
}
},
"nbformat": 4,
"nbformat_minor": 2
}