Cours:PiPico : Différence entre versions
Ligne 41 : | Ligne 41 : | ||
**https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf partie 7.1 | **https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf partie 7.1 | ||
**https://www.electronicshub.org/program-raspberry-pi-pico-with-visual-studio-code/ | **https://www.electronicshub.org/program-raspberry-pi-pico-with-visual-studio-code/ | ||
+ | *https://github.com/raspberrypi/picotool |
Version du 21 novembre 2022 à 23:27
Créer/configurer un projet vscode
- pico_project.py
- git clone https://github.com/raspberrypi/pico-project-generator.git
- ./pico_project.py --gui
- ne pas cocher "create VSCode project"
GPIO
https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__gpio.html
Syntaxe | void gpio_init(uint gpio) | ||
---|---|---|---|
Paramètres |
|
- 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