Advertisement
j0h

Poptart_Cannon_IR_Trigger

j0h
Jan 15th, 2023
1,224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <IRremote.h>
  2. //Built on a teensy 4.1
  3. const int RECV_PIN = 3;
  4. const int led = 2;
  5.  
  6. IRrecv irrecv(RECV_PIN);
  7. decode_results results;
  8.  
  9. void setup(){
  10.   Serial.begin(9600);
  11.   irrecv.enableIRIn(); // Start the receiver
  12.   irrecv.blink13(true);
  13.   pinMode(led, OUTPUT);
  14. }
  15.  
  16. void loop() {
  17.  if (irrecv.decode(&results)) {
  18.  Serial.println(results.value);
  19.  if(results.value==4294967295){ //4294967295 is a return value, so any button press will trigger it.
  20.     digitalWrite(led, HIGH);    //Just flick the igniter.
  21.     delay(3000);
  22.     digitalWrite(led, LOW);
  23.   }
  24.   }
  25.    irrecv.resume(); // Receive the next value
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement