Guest User

Untitled

a guest
Mar 18th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. #include <SPI.h>
  2. #include <Ethernet.h>
  3. #include <BlynkSimpleEthernet.h>
  4. #include <IRremote.h>
  5.  
  6. // You should get Auth Token in the Blynk App.
  7. // Go to the Project Settings (nut icon).
  8. char auth[] = "--REDACTED--";
  9.  
  10. #define W5100_CS 10
  11. #define SDCARD_CS 4
  12.  
  13. const int switchPin = 7;
  14.  
  15. int delayPeriod = 500;
  16. int i;
  17. IRsend irsend;
  18. EthernetClient client;
  19. byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
  20. byte ip[] = { 192, 168, 0, 177 };
  21. char server[] = "blynk-cloud.com";
  22.  
  23. void setup()
  24. {
  25. // Debug console
  26. Serial.begin(9600);
  27. Ethernet.begin(mac, ip);
  28.  
  29. pinMode(SDCARD_CS, OUTPUT);
  30. digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
  31.  
  32. Blynk.begin(auth);
  33. // You can also specify server:
  34. //Blynk.begin(auth, "blynk-cloud.com", 8442);
  35. //Blynk.begin(auth, IPAddress(192,168,1,100), 8442);
  36.  
  37. // Set Switch pin as Input
  38. pinMode(switchPin, INPUT);
  39. }
  40.  
  41. void loop()
  42. {
  43.  
  44. int buttonState = 0;
  45.  
  46. Blynk.run();
  47. // You can inject your own code or combine it with other sketches.
  48. // Check other examples on how to communicate with Blynk. Remember
  49. // to avoid delay() function!
  50.  
  51. // Set button state depending upon switch position
  52. buttonState = digitalRead(switchPin);
  53.  
  54. // If button is pressed send power code command
  55.  
  56. if (buttonState == HIGH) {
  57.  
  58. // NB: Not all protocols are supported by IRremote or IRLib. You may need to edit the code below manually
  59. // Automatically Generated by AnalysIR for xxxxxxxx, visit http://www.AnalysIR.com or email info@....... for further details
  60. int khz = 38; //NB Change this default value as neccessary to the correct modulation frequency
  61.  
  62. unsigned int Signal_0_0[] = {4550, 4400, 600, 1650, 550, 1650, 600, 1650, 550, 550, 600, 500, 600, 550, 550, 550, 600, 500, 600, 1650, 600, 1600, 600, 1650, 550, 550, 600, 500, 600, 550, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 500, 650, 450, 650, 500, 600, 500, 600, 500, 600, 550, 600, 1600, 600, 500, 650, 1600, 650, 1550, 650, 1600, 650, 1550, 650, 1600, 650, 1600, 600}; //AnalysIR Batch Export - RAW
  63.  
  64. irsend.sendRaw(Signal_0_0, sizeof(Signal_0_0) / sizeof(int), khz); //AnalysIR Batch Export - RAW
  65. // AnalysIR IR Protocol: RAW, Key:
  66.  
  67.  
  68. // Add a small delay before repeating
  69. delay(200);
  70.  
  71.  
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment