CHULETA

Classified in Computers

Written on in English with a size of 4.63 KB

 int led = 13; int boton = 2;                       int pot1; int pot2; int led = 9;
 void setup ( ) {                                          void setup ( ) {
 pinMode (led, OUTPUT);                          Serial.Begin (9600);
 pinMode (botón, INPUT);                         pinMode (led, OUTPUT);
 }                                                                }
 void loop ( ) {                                            void loop ( ) {         
 if (digitalRead (boton) == HIGH) {           pot1= analogRead (A0);
     digitalWrite (led, HIGH);                       pot2= map( pot1, 0, 1023, 255);
 }                                                                Serial.Println (pot2);
 else {                                                         delay (1000);
   digitalWrite (led, LOW);                          analogWrite (led, pot2);
 }                                                                }
 }



 int LDR;                                                    int LDR;
 void setup ( ) {                                         void setup ( ) {
 Serial.Begin (9600);                                  Serial.Begin (9600);
 }                                                               }

 void loop ( ) {                                           void loop ( ) {        

 LDR = analogRead (A1);                          LDR = analogRead (A1);     

 Serial.Println (LDR);                                  Serial.Println (LDR);                     
 delay (700);                                              delay (900);
 if (LDR<< 200) {                                       if (LDR<= 450) {
   analogWrite (9, 255);                             tone (5, 440, 1000);
 }                                                               }
 else {                                                        else {
     analogWrite (10, 0);                             if (LDR>= 750);
 }                                                               tone (5, 0, 0);
     analogWrite (11, 0);                             }
 }












Related entries: