You will construct a detector the uses infrared (IR) signal to sense how close an object is.
Software Discovery: None
Other Discovery: IR, Transistor, Theramin
Qty Part
1 IR LED [3mm]
1 IR phototransistor
1 Resistor [220Ω]
1 Resistor [1 kΩ]
Software Discovery: None
Other Discovery: IR, Transistor, Theramin
Qty Part
1 IR LED [3mm]
1 IR phototransistor
1 Resistor [220Ω]
1 Resistor [1 kΩ]
Lets got Coding!
int threshold;
const int ir = A4;
void setup()
{
Serial.begin(9600); // the spd at which data is transferred to SM
}
void loop()
{
threshold = analogRead(ir); // Assigns analogVal to the analog input port
Serial.println(threshold); // Display the value of analogVal on the SM
delay(20); // Reading is taken every 20 ms (more stable)
}
int threshold;
const int ir = A4;
void setup()
{
Serial.begin(9600); // the spd at which data is transferred to SM
}
void loop()
{
threshold = analogRead(ir); // Assigns analogVal to the analog input port
Serial.println(threshold); // Display the value of analogVal on the SM
delay(20); // Reading is taken every 20 ms (more stable)
}