Smarthouse prototip

                Never    
C
       
#include <IRremote.h>
#include <Stepper.h>

#define IN1 8
#define IN2 9
#define IN3 10
#define IN4 11

int stepsPerRevolution = 200; //koraka po punom okretanju



int RECV_PIN = 7;
int LED_1 = 6;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(LED_1, HIGH);

  myStepper.setSpeed(60); //okretaji motora

  
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);

    if (results.value == 0xFF30CF)
    {
      digitalWrite(LED_1, HIGH); //pali osvjetljenje
    }
    else if (results.value == 0xFF18E7) //gasi osvjetljenje
    {
      digitalWrite(LED_1, LOW);
    }
    else if (results.value == 0xFF7A85) //digni roletnu
    {
        myStepper.step(stepsPerRevolution);
    }
    else if (results.value == 0xFF10EF) //spusti roletnu
    {
        myStepper.step(-stepsPerRevolution);
    }
    irrecv.resume(); // Receive the next value
  }
  delay(100);
}