Yulinar Angreasti
Published © CC BY

Menyalakan Lampu Menggunakan Sensor InfraRed dan Arduino

Project ini untuk menyalakan lampu dengan bantuan sensor infraRed, jadi ketika suatu benda menghalangi sensor maka lampu akan menyala.

EasyProtip2 hours2,636
Menyalakan Lampu Menggunakan Sensor InfraRed dan Arduino

Things used in this project

Hardware components

Arduino 101 & Genuino 101
Arduino 101 & Genuino 101
×1
Infrared Module
Tessel Infrared Module
×1
LED (generic)
LED (generic)
×1
Breadboard Expansion for NI myRIO
Digilent Breadboard Expansion for NI myRIO
×1
4-CHANNEL RELAY CONTROLLER FOR I2C
ControlEverything.com 4-CHANNEL RELAY CONTROLLER FOR I2C
×1
Jumper
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Obeng

Story

Read more

Custom parts and enclosures

Menyalakan Lampu Menggunakan Sensor InfraRed dan Arduino

Schematics

Menyalakan Lampu Menggunakan Sensor InfraRed dan Arduino

Photogrid 1503638763189 eoap9ivrxm

Code

Coding

Arduino
#include "Arduino.h"


class Pronto {

  public:

    Pronto(int pin);

    void ir_start(uint16_t *code);

    void handleInterrupt(); //Interrupt Timer Overflow Function

  private:

    int _pin;

    void ir_on();

    void ir_off();

    void ir_toggle();

    void ir_stop();

};

Coding

Arduino
#include <Ultrasonic.h>


Ultrasonic ultrasonic(5,6); // (Trig PIN,Echo PIN)


void setup() {

Serial.begin(9600);

pinMode(4, OUTPUT); // VCC pin

pinMode(7, OUTPUT); // GND ping

digitalWrite(4, HIGH); // VCC +5V mode 

digitalWrite(7, LOW); // GND mode

}


void loop()

{

Serial.print(ultrasonic.Ranging(CM)); // CM or INC

Serial.println(" cm" );

delay(100);

}

Credits

Yulinar Angreasti

Yulinar Angreasti

0 projects • 0 followers
15650021

Comments

Add projectSign up / Login