Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- Giamarchi
- Date:
- 2021-12-17
- Revision:
- 2:a54463860e4e
- Parent:
- 1:95172f59262a
- Child:
- 3:c2c310607375
File content as of revision 2:a54463860e4e:
//============================================================================== // FabLab Nîmes // Initiation à la Programmation // Auteur : Frédéric Giamarchi // Date : 3 dec. 2021 // TP 04 : Communication série avec le PC // Faire varier la luminosité de la DEL par appui sur la touche 'p' ou 'm' //============================================================================== // Déclarations des ressources #include "mbed.h" //============================================================================== // Déclaration des broches PwmOut DEL(PA_11); // Ligne PA_11 en mode PWM Serial pc(USBTX, USBRX); // Dialogue Série port USB à 9600 Baud //============================================================================== // Déclaration des variables int8_t variable; // variable de type entier (0 à 255) char c; // variable de type caractère //============================================================================== // Début du Programme int main() // Fonction principale { pc.printf("\r\nFabLab TP 4\r\n\n"); // Affiche un message sur le PC pc.printf("p -> pour augmenter la luminosite\r\n"); pc.printf("m -> pour diminuer la luminosite\r\n"); variable = 0; DEL.period_ms(20); // Définit la période du signal //============================================================================== // Boucle Infinie while(1) { DEL.pulsewidth_ms(variable); // Définit la durée du temps haut (en ms) } // Fin du while(1) //============================================================================== } // Fin du Programme //==============================================================================