TiLDA MK3/Get Started: Difference between revisions

From EMF Badge
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:
Windows will require a driver file for the serial port, which is stored on the badge's mass storage. [https://micropython.org/resources/Micro-Python-Windows-setup.pdf More information]
Windows will require a driver file for the serial port, which is stored on the badge's mass storage. [https://micropython.org/resources/Micro-Python-Windows-setup.pdf More information]


== 3. Check you have all the right software ==
== 3. Connect to your badge ==
 
=== Windows ===
* Please follow the instruction under the "Windows" section on this page: https://micropython.org/doc/tut-repl
* Once you've installed the driver and Putty and you've connected to your badge you should now be greeted by a line saying "Micropython"
 
=== OSX ===
* Click the magnifying class in the top right of your screen and type <code>Terminal</code> followed by Enter. A white terminal window should appear.
* type <code>/dev/tty.usbmodem*</code> (The * is important, so don't let it out) and hit enter
* You should now be greeted by a line saying "Micropython"
 
=== Linux ===
* Open a terminal and type <code>screen /dev/ttyACM0</code>
* You should now be greeted by a line saying "Micropython"
 
=== What to do if this step doesn't work? ===
* Press the reset button at the back of your badge and try again
* Have a look at https://micropython.org/doc/tut-repl for more information
 
== 4. Your first line of Micropython ==
* In your terminal (next to the >>>) type <code>print(1 + 1)</code> followed by Enter
* You should see <code>2</code> printed on the screen. Congratulations, you've just written your first line of micropython code!
* You can now close the terminal window (or Putty, if you're on Windows)


== (Optional) 4. Update your badge ==
== (Optional) 4. Update your badge ==
'You can skip this step', but since TiLDA is still a work in progress, it's best to update regularly. It's easy, just follow the instructions on [update.badge.emfcamp.org].
'You can skip this step', but since TiLDA is still a work in progress, it's best to update regularly. It's easy, just follow the instructions on https://update.badge.emfcamp.org.
 
<source lang="php" enclose="div">
php_info()
</source>


== 5. Download the pyboard.py script ==
== 5. Download the pyboard.py script ==

Revision as of 21:56, 25 July 2016

Get started

Hacking your TiLDA badge is easy. We've written it down step by step.

If something goes wrong, the badge can be reset to its out-of-the-box state, so do not be concerned about breaking anything.

1. Connect to your computer

To get started you need to connect your badge to a computer. You can use any MicroUSB cable - the same type that charges most mobile phones nowadays. It doesn't matter whether the batter is plugged in or not, so don't worry about it.

2. Check your badge is found by your computer

Upon connecting the badge to a computer, it should appear as a "mass storage device" just like a USB key or an external hard disk.

Important: Just like any other USB storage device, if you changed or copied anything on the Badge, please make sure to "eject" or "safely remove" before unplugging your badge or pressing the reset button. Otherwise you might lose all your work :(

Windows will require a driver file for the serial port, which is stored on the badge's mass storage. More information

3. Connect to your badge

Windows

  • Please follow the instruction under the "Windows" section on this page: https://micropython.org/doc/tut-repl
  • Once you've installed the driver and Putty and you've connected to your badge you should now be greeted by a line saying "Micropython"

OSX

  • Click the magnifying class in the top right of your screen and type Terminal followed by Enter. A white terminal window should appear.
  • type /dev/tty.usbmodem* (The * is important, so don't let it out) and hit enter
  • You should now be greeted by a line saying "Micropython"

Linux

  • Open a terminal and type screen /dev/ttyACM0
  • You should now be greeted by a line saying "Micropython"

What to do if this step doesn't work?

4. Your first line of Micropython

  • In your terminal (next to the >>>) type print(1 + 1) followed by Enter
  • You should see 2 printed on the screen. Congratulations, you've just written your first line of micropython code!
  • You can now close the terminal window (or Putty, if you're on Windows)

(Optional) 4. Update your badge

'You can skip this step', but since TiLDA is still a work in progress, it's best to update regularly. It's easy, just follow the instructions on https://update.badge.emfcamp.org.

php_info()

5. Download the pyboard.py script

6. Test that everything is working

7. Blink

8. Hello Screen

9. Buttons

10. Your own app

Alternative ways to work with TiLDA

All of the python code which runs on the badge can be modified on the mass storage device, and new apps can be added this way too. Be careful when using text editors to modify files on the device, if the mass storage is not 'safely removed' before removal, corruption of the file being edited can occur.

When writing your own code, it is advised edit code on your computer, then copy it across to the badge, wait for the red 'writing' LED to go out, reset it, and run. This way you don't need to worry about safely removing the badge each time.


To interactively run code on the badge, a python REPL can be accessed via the virtual serial port. Once you have found the serial port, use your favourite serial terminal to connect to the badge. Since the badge will be running the main software, press Ctrl+c to stop it, and the badge will display '>>>' to indicate it is ready to receive commands.

The badge runs micropython, and as a result does not contain everything you may expect from full python. See the micropython docs in the lniks below for more information. The badge has additional APIs, in particular for the LCD, Wifi and IMU, which are also listed below.