Guest User

Untitled

a guest
Feb 19th, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. //Developed by j0lama
  2. //Visit jolama.es
  3.  
  4. #include <SoftwareSerial.h>
  5.  
  6. #define tiempo 400
  7.  
  8. #define pin 9
  9.  
  10. void setup() {
  11.   Serial.begin(9600);
  12.   while (!Serial);
  13.   pinMode(pin, OUTPUT);
  14.   Serial.println("Dentro de 2 segundos va a mandar el codigo.");
  15. }
  16.  
  17. void loop() {
  18.   int code[170] = {1,0,0,1,1,0,1,1,0,1,1,0,1,0,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,0,0,1,1,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,0,0,1,0,0,1,1,0,1,1,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0,1,1,0,1,0,0,1,1,0,1,0,0,1,0,0,1,0,0,1,1,0,1,1,0,1,0,0,1,1,0,1,0,0,1,1,0,1,1,0,1,0,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,0,0,1,1,0,1,1,0,1,1,0,1,1};
  19.   int i, j;
  20.     Serial.println("Empezando las 3 tandas.");
  21.     for(i = 0; i < 3; i++)
  22.     {
  23.       for(j = 0; j < 197; j++)
  24.       {
  25.         if(code[j] == 1)
  26.         {
  27.           digitalWrite(pin, HIGH);
  28.           delayMicroseconds(tiempo);
  29.           digitalWrite(pin, LOW);
  30.         }
  31.         else
  32.         {
  33.           delayMicroseconds(tiempo);
  34.         }
  35.       }
  36.       Serial.println("Tanda enviada.");
  37.       delay(15);
  38.     }
  39.     Serial.println("Final");
  40.     delay(1000);
  41. }
Add Comment
Please, Sign In to add comment