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:
- marques_rascol
- Date:
- 2020-09-09
- Revision:
- 0:5978ae03d34b
- Child:
- 1:42d9c1e77915
File content as of revision 0:5978ae03d34b:
#include "mbed.h" // On incluse la librairie "mbed.h" pour pouvoir utiliser des fonctions déja exsitente.
DigitalOut red(LED1);
DigitalOut green(LED2);
DigitalOut blue(LED3);
DigitalIn BP1(SW2);
DigitalIn BP2(SW3);
DigitalIn BP3(D3); // bouton grove
int main() { // Fonction principale du programme.
while(1) { // Fonction pour faire une boucle, le 1 est utiliser pour que la boucle ne s'arrête pas.
if(BP1&&BP2&&!BP3) // Rien d'activer = rien d'allumer
{
red=1;green=1;blue=1;
}
if(!BP1&&BP2&&!BP3) // BP1 activer = bleue
{
red=1;green=1;blue=0;
}
if(!BP1&&!BP2&&!BP3) // BP1 et BP2 activer = rouge
{
red=0;green=1;blue=1;
}
if(!BP1&&BP2&&BP3) // BP1 et BP3 activer = magenta
{
red=0;green=1;blue=0;
}
if(!BP1&&!BP2&&BP3) // BP1 BP2 et BP3 activer = tout allumer
{
red=0;green=0;blue=0;
}
if(BP1&&!BP2&&!BP3) // BP2 activer = vert
{
red=1;green=0;blue=1;
}
if(BP1&&BP2&&BP3) // BP3 activer = cyan
{
red=1;green=0;blue=0;
}
if(BP1&&!BP2&&BP3) // BP2 et BP3 activer = jaune
{
red=0;green=0;blue=1;
}
}
}