Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //lAB 5
- //Crhistian David Lucumi
- //Usc
- //Version 1.2
- int valor=0;
- #define MAX 9
- int led[MAX]={
- 3, 5 , 6};
- int t_off=100;
- int t_offA=100;
- int t_on=100;
- void setup(){
- Serial.begin(9600);
- for(int pin=0; pin<=MAX;pin++){
- pinMode(led[pin], OUTPUT);
- }
- }
- void loop(){
- if (Serial.available()>0){
- valor=Serial.read();
- if (valor=='R'){
- t_on=Serial.parseInt();
- }
- if (valor=='G'){
- t_off=Serial.parseInt();
- }
- if (valor=='B'){
- t_offA=Serial.parseInt();
- }
- }
- prender(led[0], t_on);
- prender(led[1], t_off);
- prender(led[2], t_offA);
- }
- void prender(int le, int tem){
- analogWrite(le, tem);
- }
- void apagar(int le, int tem){
- analogWrite(le, tem);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement