|
| 1 | +NOTES FOR REPL (READ EVAL PRINT LOOP) |
| 2 | + |
| 3 | +- Easiest way to test code and run commands on the pyboard |
| 4 | +- Can be used in addition to the main.py script |
| 5 | +- Need to be connected to pyboard's USB serial (instructions below) |
| 6 | + |
| 7 | +----------------------------- |
| 8 | + |
| 9 | +Mac OS X |
| 10 | + |
| 11 | +1. Open Terminal |
| 12 | +2. Type in the following and hit enter: |
| 13 | + screen /dev/tty.usbmodem* |
| 14 | + |
| 15 | +----------------------------- |
| 16 | + |
| 17 | +Windows: |
| 18 | + |
| 19 | +1. Make sure the pyboard driver('pybcdc.inf' which is visible in the same directory as 'main.py' and 'boot.py') is installed. |
| 20 | +2. Access the Device Manager (Start > Control Panel > Device Manager) and click on 'Ports' to check the port to which the pyboard is connected (eg. COM8). |
| 21 | +3. Install PuTTY < http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html > |
| 22 | +4. Run putty.exe |
| 23 | +5. In the PuTTY Configuration window, click on 'Session' on the left pane. |
| 24 | +6. Under 'Connection type', select 'Serial' |
| 25 | +7. Change the 'Serial line' field to the port on which your pyboard is connected (eg. COM8) |
| 26 | +8. Change 'Speed' to 115200 |
| 27 | +9. Click Open |
| 28 | + |
| 29 | +----------------------------- |
| 30 | + |
| 31 | +Linux: |
| 32 | +1. Open any terminal |
| 33 | +2. Type in the following and hit enter: |
| 34 | + screen /dev/ttyACM0 |
| 35 | +3. You may have to replace ACM0 with ACM1 or a higher number and may have to prefix sudo to the command |
| 36 | + |
| 37 | +----------------------------- |
| 38 | + |
| 39 | +Now that the serial program is running hit enter and the prompt i.e. >>> will appear |
| 40 | + |
| 41 | +Type in the following and hit enter: |
| 42 | + |
| 43 | +pyb.LED.toggle(4) |
| 44 | + |
| 45 | +The blue led on the board should toggle its state (if on, goes off and vice versa) |
| 46 | +On most terminals the upward arrow key is a shortcut to go to the last used command. Hit it and pyb.LED.toggle(4) should re-appear. If not just type it out. Hit enter. |
| 47 | +The state of the blue LED on the pyboard (LED 4) toggles its state each time the command is called. |
| 48 | + |
| 49 | + |
| 50 | +FOOTNOTE: added a boot.py that imports pyb and an empty main.py |
| 51 | +If pyb is not imported it will obviously need to be imported while playing with REPL. |
0 commit comments