hello everybody,
i'm really new to programming enviroment and i am facing some problems
i'd made this programm in order to read the values from remote control and open or close the relay. Also i wanted to control it via serial monitor, in order when i press the number 3 the remote will close and the number 1 opens. But in compiling im facing this: IRrelay:62: error: expected unqualified-id before '{' token
The code is copied-pasted from another guy which has done something similar for leds. Although i have made some adjustments
#include <IRremote.h>
int relay_pin = 5;
int recv_pin = 7;
int actual_state = LOW;
IRrecv irrecv(recv_pin);
decode_results results;
void setup() {
pinMode(relay_pin, OUTPUT);
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
if (results.value == 0xffa25d)
{ // On/Off button
actual_state = (actual_state == LOW) ? HIGH : LOW;
digitalWrite(relay_pin, actual_state);
}
if (results.value == 0x0080c)
{ // On/Off button
actual_state = (actual_state == LOW) ? HIGH : LOW;
digitalWrite(relay_pin, actual_state);
}
if (results.value == 0x00c)
{ // On/Off button
actual_state = (actual_state == LOW) ? HIGH : LOW;
digitalWrite(relay_pin, actual_state);
}
irrecv.resume(); // Receive the next value
}
if (Serial.available()) {
//read serial as ascii integer
int ser = Serial.read();
//Print the value in the serial monitor
Serial.println(ser);
if(ser >= 48 && ser <= 57){
//The ascii equivilent of numbers 0 - 9 are 48 - 57
// so subtracting 46 from the ascii gives us 2 - 12 (the pins we want to use)
int usePin = ser - 46;
int shutPin = ser - 46;
int triggerPin(usePin);
}
}
}
{
void triggerPin(int pin){
digitalWrite(pin, HIGH);
}
void ser(int num){
if(num = 49){
digitalWrite(pin, LOW);
}
}
}
}