TiLDA MK3/Run Code: Difference between revisions

From EMF Badge
Jump to navigation Jump to search
(Created page with "= Option 1: REPL = REPL stands for "[https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop Read–eval–print loop]" and allows you to run python code, line by l...")
 
Line 7: Line 7:


= Option 2: Copying files =
= Option 2: Copying files =
You can also copy your code to <code>main.py</code> on your badge, safely eject and then reset the badge via the button. To debug it you can use the serial console (see option 1) which will show you all text printed via <code>print()</code> and errors.  
You can also copy your code to <code>main.py</code> on your badge, safely eject and then reset the badge via the button. To debug it you can use the serial console (see option 1) which will show you all text printed via <code>print()</code> and errors.
 
<strong>Note:</strong> It's very important to always correctly "eject" the usb storage before pressing the reset button, otherwise your filesystem is going to corrupt and you might have to [[TiLDA_MK3/reset|factory reset]] your badge


= Option 3: pyboard.py =
= Option 3: pyboard.py =

Revision as of 08:07, 6 August 2016

Option 1: REPL

REPL stands for "Read–eval–print loop" and allows you to run python code, line by line. This is a great way to see effects of certain hardware commands instantly and to test basic python features.

This allows you to run code, line by line, on the badge and to see the effects instantly. Follow https://micropython.org/doc/tut-repl or follow step 1-4 on the Get Started guide.

Note: This will only work if you have an empty main.py on your badge to stop the home screen from taking over instantly. If an app or script is already running you will not get a REPL that you can use to program, but simple debug output instead.

Option 2: Copying files

You can also copy your code to main.py on your badge, safely eject and then reset the badge via the button. To debug it you can use the serial console (see option 1) which will show you all text printed via print() and errors.

Note: It's very important to always correctly "eject" the usb storage before pressing the reset button, otherwise your filesystem is going to corrupt and you might have to factory reset your badge

Option 3: pyboard.py