What is the right IR receiver for BS2 and the experiments from the BoeBot manua
I was today at Radioshack, and only found "IR RECEIVED and IR DETECTOR package for 3:49 i think. But the part shown in the tutorial from Parallax has 3 pins, rather than 2. What's going on here?
Comments
What can i do with the infrared phototransistor? What's it's application?
The whole purpose of using modulated IR is to minimize the effect of ambient light. Room lights and the sun don't put out 38KHz pulses of light although some compact fluorescent bulbs did. The manufacturers of the bulbs changed the frequency to try to avoid this.
Here is some code I use with that detector and a universal remote programmed for SONY.· This code drives my bot, works some led's, and moves a ping servo back and forth.· The subs for actual direction are missing, they are not needed for this example.
IrDet PIN 9 irPulse VAR Word remoteCode VAR Byte DO GOSUB Get_Ir_Remote_Code IF remoteCode = 6 THEN GOSUB turn_right IF remoteCode = 4 THEN GOSUB turn_left IF remoteCode = 2 THEN GOSUB go_foreword IF remoteCode = 8 THEN GOSUB go_back IF remoteCode = 5 THEN GOSUB no_motion IF remotecode = 7 THEN GOSUB ping_left IF remoteCode = 9 THEN GOSUB ping_right IF remoteCode = 0 THEN GOSUB ping_center IF remoteCode = 3 THEN GOSUB led IF remoteCode = 1 THEN GOSUB ledoff LOOP RETURN Get_Ir_Remote_Code: remoteCode = 0 ' Clear all bits in remoteCode ' Wait for resting state between messages to end. DO RCTIME IrDet, 1, irPulse LOOP UNTIL irPulse > 1000 ' Measure start pulse. If out of range, then retry at Get_Ir_Remote_Code. RCTIME 9, 0, irPulse IF irPulse > 1125 OR irPulse < 675 THEN GOTO Get_Ir_Remote_Code ' Get data bit pulses. RCTIME IrDet, 0, irPulse ' Measure pulse IF irPulse > 300 THEN remoteCode.BIT0 = 1 ' Set (or leave clear) bit-0 RCTIME IrDet, 0, irPulse ' Measure next pulse IF irPulse > 300 THEN remoteCode.BIT1 = 1 ' Set (or leave clear) bit-1 RCTIME IrDet, 0, irPulse ' etc IF irPulse > 300 THEN remoteCode.BIT2 = 1 RCTIME IrDet, 0, irPulse IF irPulse > 300 THEN remoteCode.BIT3 = 1 RCTIME IrDet, 0, irPulse IF irPulse > 300 THEN remoteCode.BIT4 = 1 RCTIME IrDet, 0, irPulse IF irPulse > 300 THEN remoteCode.BIT5 = 1 RCTIME IrDet, 0, irPulse IF irPulse > 300 THEN remoteCode.BIT6 = 1 ' Adjust remoteCode so that keypad keys correspond to the value ' it stores. IF (remoteCode < 10) THEN remoteCode = remoteCode + 1 IF (remoteCode = 10) THEN remoteCode = 0 RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."