lecture d'un bouton
This commit is contained in:
parent
52dfbc2ead
commit
88ffe4f03a
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -1,5 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
|
||||
"stdio.h": "c"
|
||||
}
|
||||
}
|
||||
23
main.c
23
main.c
@ -5,12 +5,29 @@
|
||||
*/
|
||||
#include "pico/stdlib.h"
|
||||
#include <stdio.h>
|
||||
|
||||
bool bouton_Presser = false;
|
||||
void main(void)
|
||||
{
|
||||
stdio_init_all();
|
||||
gpio_init(8);
|
||||
gpio_init(9);
|
||||
gpio_set_function(8,GPIO_IN);
|
||||
gpio_set_function(9,GPIO_OUT);
|
||||
gpio_set_function(25,GPIO_OUT);
|
||||
gpio_pull_down(8);
|
||||
gpio_put(9,true);
|
||||
gpio_put(25,true);
|
||||
sleep_ms(5000);
|
||||
printf("kartoffen\n");
|
||||
while(1){
|
||||
printf("Exemple\n");
|
||||
sleep_ms(1000);
|
||||
bouton_Presser = gpio_get(8);
|
||||
printf(">a:%d\n", bouton_Presser );
|
||||
|
||||
gpio_put(25,bouton_Presser);
|
||||
if(bouton_Presser){
|
||||
printf("bouton a ete presse\n");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user