Skip to content

Instantly share code, notes, and snippets.

@cathalmccabe
Created March 31, 2017 09:51
Show Gist options
  • Save cathalmccabe/6250944f3e7b4947d75a90cf090466b4 to your computer and use it in GitHub Desktop.
Save cathalmccabe/6250944f3e7b4947d75a90cf090466b4 to your computer and use it in GitHub Desktop.
LED Example
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# LED heading\n",
"\n",
"An LED example\n",
"\n",
"![board](http://lh3.googleusercontent.com/MraaVssyZqWBoGnA3I1lZMfHlHpPI6kIN30DUryHjor93BAQLALsOASgJPdBg520qAeWhRVhfypOYAsY7ae4PeScro4=s358)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from pynq.board import LED"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"led = LED(0)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"led.on()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Turn off LED"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"led.off()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import time\n",
"for i in range(10):\n",
" led.toggle()\n",
" time.sleep(.1)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment