Hi guys I'm new to this I'm trying to find a code to control a solenoid through relays using a remote control. I have the receiver reading the remote codes through the serial monitor but cant find a program to give me an output to the relays. Any help would be appreciated >:(
You will find it between your ears.
You do have code that can display an IR remote button push code?
If so then you can turn an output on with a simple comparison.
What part are you having problems with?
Show us what you have tried.
Please use code tags. Use the </> icon in the posting menu. [code] Paste sketch here. [/code]
.
toolboss100:
I'm trying to find a code to control a solenoid through relays using a remote control.
For finding (aka searching) use Google. But don't expect every user case to be done before for you. This is a forum to help people learn programming the Arduino. Aka, making there own programs. It's fine to reuse code but you have to make it work
toolboss100:
I have the receiver reading the remote codes through the serial monitor but cant find a program to give me an output to the relays. Any help would be appreciated >:(
So start programming! Learn how to do it. What have you done right now? Which step you are stuck at? Schematics? etc
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
delay(100);
}
This is the code I used to get the remote codes up in the serial monitor no problem but then tried to program it off various clips on youtube using this as the example code but keep getting error codes when trying to upload as I say I'm new to this and trying to learn. Ive searched numerous sites but none seem to have advice on getting a signal out to the relay when using a remote. Cheers guys
Do you know how to make a LED light using a output pin on the Arduino?
Do you know how to use the if() function?
https://www.arduino.cc/en/Reference/If
How to connect a relay to an Arduino output
What IR remote do you have?
Do you know what the codes are for each button.
.
Yeah Larry D got all the codes coming up in the serial monitor off the remote but struggling to get it to output to a pin on the board. When I push the remote the tx led is working in conjunction with the remote but that's about it. Thanks in advance
You have to do some thing like below. It's a pseudo code.
pinMode(RELAY_PIN, OUTOUT);
In loop function, after reading the IR code
if(result=='X'){
digitalWrite(RELAY_PIN, HIGH)
}
else if(result=='y'){
digitalWrite(RELAY_PIN, LOW)
}