Thonny permet également d'écrire du code Python dans un fichier et de l'exécuter en une seule fois sur la plateforme MicroPython cible.
+
With Thonny you can also write Python code inside a file and execute it at once on the target MicroPython board.
−
Dans l'exemple suivant la luminosité de la LED de statut est contrôlée à l'aide d'un signal PWM (valeur entre 0 et 65534 pour un cycle utile de 0 à 100% .
+
In the following example, the status LED (GP25) is pulsed by controling the output pin with PWM signal.
−
C'est le cas de code suivant:
+
PWM stand for ''Pulse Width Modulation'', see this [https://www.electronicwings.com/pic/pic18f4550-pwm animation on ElectronicWings clearly show a PWM signal with its duty cycle and results on a LED].
+
+
Under MicroPython, the duty cycle is set with {{fname|duty_16( value )}} where value is a number from 0 to 65534 (for duty cycle from 0 to 100% .
+
+
+
Key-in the following code into the main's Thonny section (the code editor):