Modifications

Sauter à la navigation Sauter à la recherche
2 530 octets ajoutés ,  22 mai 2016 à 18:35
Ligne 25 : Ligne 25 :     
Using your serial program you must connect to the COM port that you found in the previous step. With PuTTY, click on “Session” in the left-hand panel, then click the “Serial” radio button on the right, then enter you COM port (eg COM4) in the “Serial Line” box. Finally, click the “Open” button.
 
Using your serial program you must connect to the COM port that you found in the previous step. With PuTTY, click on “Session” in the left-hand panel, then click the “Serial” radio button on the right, then enter you COM port (eg COM4) in the “Serial Line” box. Finally, click the “Open” button.
 +
 +
== Avec Mac OS X ==
 +
Open a terminal and run:
 +
 +
<nowiki>$ telnet 192.168.1.1</nowiki>
 +
 +
or:
 +
 +
<nowiki>$ screen /dev/tty.usbmodem* 115200</nowiki>
 +
 +
When you are finished and want to exit screen, type CTRL-A CTRL-\.
 +
 +
== Avec Linux ==
 +
Open a terminal and run:
 +
 +
<nowiki>$ telnet 192.168.1.1</nowiki>
 +
 +
or:
 +
 +
<nowiki>$ screen /dev/ttyUSB0 115200</nowiki>
 +
 +
You can also try {{fname|picocom}} or {{fname|minicom}} instead of screen. You may have to use {{fname|/dev/ttyUSB01}} or a higher number for {{fname|ttyUSB}}. And, you may need to give yourself the correct permissions to access this devices (eg group {{fname|uucp}} or {{fname|dialout}}, or use sudo).
 +
 +
== Utiliser l'invite REPL ==
 +
Now let’s try running some MicroPython code directly on the WiPy.
 +
 +
With your serial program open (PuTTY, screen, picocom, etc) you may see a blank screen with a flashing cursor. Press Enter and you should be presented with a MicroPython prompt, i.e. {{fname|>>>}}. Let’s make sure it is working with the obligatory test:
 +
 +
<nowiki>>>> print("hello WiPy!")
 +
hello WiPy!</nowiki>
 +
 +
In the above, you should not type in the {{fname|>>>}} characters. They are there to indicate that you should type the text after it at the prompt. In the end, once you have entered the text {{fname|print("hello WiPy!")}} and pressed Enter, the output on your screen should look like it does above.
 +
 +
If you already know some Python you can now try some basic commands here.
 +
 +
If any of this is not working you can try either a hard reset or a soft reset; see below.
 +
 +
Go ahead and try typing in some other commands. For example:
 +
 +
<syntaxhighlight lang="python">
 +
>>> from machine import Pin
 +
>>> import wipy
 +
>>> wipy.heartbeat(False)  # disable the heartbeat
 +
>>> led = Pin('GP25', mode=Pin.OUT)
 +
>>> led(1)
 +
>>> led(0)
 +
>>> led.toggle()
 +
>>> 1 + 2
 +
3
 +
>>> 4 // 2
 +
2
 +
>>> 20 * 'py'
 +
'pypypypypypypypypypypypypypypypypypypypy'
 +
</syntaxhighlight>
 +
 +
== Réinitialiser la carte ==
 +
If something goes wrong, you can reset the board in two ways. The first is to press CTRL-D at the MicroPython prompt, which performs a soft reset. You will see a message something like:
 +
 +
<nowiki>>>>
 +
PYB: soft reboot
 +
MicroPython v1.4.6-146-g1d8b5e5 on 2015-10-21; WiPy with CC3200
 +
Type "help()" for more information.
 +
>>></nowiki>
 +
 +
If that isn’t working you can perform a hard reset (turn-it-off-and-on-again) by pressing the RST switch (the small black button next to the heartbeat LED). During telnet, this will end your session, disconnecting whatever program that you used to connect to the WiPy.
    
{{WIPY-TRAILER}}
 
{{WIPY-TRAILER}}
29 917

modifications

Menu de navigation