You can get your students to to research libraries and find out how Remote library works This code is to show how the Remote signal works by creating code to support
int irpin = 7;
unsigned long duration;
String Data;
void setup()
{
pinMode(irpin, INPUT);
Serial.begin(9600);
}
void loop()
{
duration = pulseIn(irpin,LOW);
//when the remote starts it sends a big LOW start bit
if(duration > 5000)
{
//we clear all data and counters
Data = "";
int i=1;
while (i < 32) //we count 32 bits of data
{
duration = pulseIn(irpin,HIGH);
i = i + 1;
if (i > 16 && i <= 24) //we capture the 8 bits of data we want
{
//If light is on for more then 1000us its a 1
if(duration > 1000) Data = Data + 1;
//if light is on for less then 1000us its a 0
if(duration < 1000) Data = Data + 0;
}
}// All 32 bits have counted we now Print our Data
Serial.println(Data);
if(Data=="11001000")
{
Serial.println("This is cool");
//you can digitalWirite
}
}
}