Cours:PiPico : Différence entre versions

De troyesGEII
Aller à : navigation, rechercher
(Créer/configurer un projet vscode)
Ligne 1 : Ligne 1 :
 +
= Brochage =
 +
 +
https://datasheets.raspberrypi.com/pico/Pico-R3-A4-Pinout.pdf
 +
 
=Créer/configurer un projet vscode=
 
=Créer/configurer un projet vscode=
 
*pico_project.py
 
*pico_project.py

Version du 30 novembre 2022 à 16:26

Brochage

https://datasheets.raspberrypi.com/pico/Pico-R3-A4-Pinout.pdf

Créer/configurer un projet vscode

  • pico_project.py
  • Dans VSCode, ouvrir le dossier contenant le projet (ie le fichier CMakeLists.txt), en sélectionnant GCC for arm-none-eabi commme compilateur dans le menu déroulant de configuration du projet.

GPIO

https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__gpio.html

Syntaxe void gpio_init(uint gpio)
Paramètres
gpio numéro de gpio
  • gpio_put(LED_PIN, 1);
  • gpio_set_dir(LED_PIN, GPIO_OUT);
  • gpio_set_pulls (uint gpio, bool up, bool down)

Pwm

  • gpio_set_function(PICO_DEFAULT_LED_PIN, GPIO_FUNC_PWM);
  • uint slice_num = pwm_gpio_to_slice_num(PICO_DEFAULT_LED_PIN);
  • pwm_config config = pwm_get_default_config();
  • pwm_config_set_clkdiv(&config, 4.f);
  • pwm_init(slice_num, &config, true);
  • pwm_set_gpio_level(PICO_DEFAULT_LED_PIN, fade * fade); // rapport cyclique 16 bits


liens