Installation de CircuitPython et exemples pour Raspberry Pi Pico.
1/ Installation de CircuitPython.
Micrologigiciel : CircuitPython 6.2.0-beta.2
https://circuitpython.org/board/raspberry_pi_pico/
Flashage du micro-logiciel : https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/circuitpython
Le lecteur est nommé : CIRCUITPY
2/ Changement de permission pour l’utilisateur courant.
util01@station66:~$ sudo usermod -a -G dialout util01
Redémarrer l’ordinateur.
3/ Configuration de Thonny.
– [Run]
– [Selecter interpreter]
– Which interpreter or device should Thonny use for running your code? : CircuitPython (generic)
– Port : Pico – CircuitPython CDC control (/dev/ttyACMO0)
4/ Installation de la librairie Adafruit HID.
Lien :
https://www.youtube.com/watch?v=onBkPkaqDnk
util01@station66:~/RASPICO$ wget https://github.com/adafruit/Adafruit_CircuitPython_HID/releases/download/4.1.6/adafruit-circuitpython-hid-6.x-mpy-4.1.6.zip util01@station66:~/RASPICO$ unzip adafruit-circuitpython-hid-6.x-mpy-4.1.6.zip
util01@station66:~/RASPICO$ cp adafruit-circuitpython-hid-6.x-mpy-4.1.6/lib/ /media/util01/CIRCUITPY/ -R
5/ Clignotement de la LED 25.
Lien :
https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/blinky-and-a-button
Créer :
code.py
Ajouter :
import time import board import digitalio led = digitalio.DigitalInOut(board.GP25) led.direction = digitalio.Direction.OUTPUT while True: led.value = True time.sleep(0.1) led.value = False time.sleep(0.1)
6/ Déplacement de pointeur de la souris.
Créer :
code.py
Ajouter :
import time import usb_hid from adafruit_hid.mouse import Mouse import board import digitalio mouse = Mouse(usb_hid.devices) time.sleep(5) mouse.move(y=400)
7/ Ecriture de texte.
Créer :
code.py
Ajouter :
import time import usb_hid from adafruit_hid.keyboard import Keyboard from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS kbd = Keyboard(usb_hid.devices) layout = KeyboardLayoutUS(kbd) time.sleep(5) layout.write('Hqcklqb\n')
Comments are closed, but trackbacks and pingbacks are open.