Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int R = 1;
- const int V = 1;
- const int B = 1;
- const int Bleu = 11;
- const int Rouge = 10;
- const int Vert = 9;
- const int VertBouton = 8;
- const int OrangeBouton = 7;
- void setup() {
- pinMode (Vert,OUTPUT);
- pinMode (Rouge,OUTPUT);
- pinMode (Bleu,OUTPUT);
- pinMode(VertBouton, INPUT_PULLUP);
- pinMode(OrangeBouton, INPUT_PULLUP);
- Serial.begin(11500);
- }
- void loop() {
- if((digitalRead(OrangeBouton) == LOW))
- {
- ledRVBpwm(235,40,10); // Orange
- }
- else if ((digitalRead(VertBouton) == LOW))
- {
- ledRVBpwm(70,243,20); // Vert
- }
- else
- {
- ledRVBpwm(0,0,0);
- }
- }
- void ledRVBpwm(int pwmRouge, int pwmVert, int pwmBleu) // 0-255 par couleur
- {
- analogWrite(Rouge, pwmRouge);
- analogWrite(Vert, pwmVert);
- analogWrite(Bleu, pwmBleu);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement