A special circuit pushes the current through the emitting diode up to 0.5A for the duration of a pulse of approximately 100µs.
Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
Panel | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Usage Zynq7000
To use the module with the Zynq7000 together with https://flink-project.ch/, you need a Reflective Photoelectric Sensor subdevice within flink. Connect it in the following way:
Microzed Board | Module |
---|---|
L14 | Trig |
N16 | A0 |
L15 | A1 |
ADC7476 | Out |
The sensor output has to be digitized by a ADC. Our Microzed adapter board for our experimental system already has an AD7476 incorporated for this purpose.
There are two drivers available. One for Python when using a Linux operating system and one for Java in combination with deep.
Python Example
Codeblock | |||||
---|---|---|---|---|---|
|
| |||
import |
flink |
tcrt1000 = |
flink. |
FlinkReflectiveSensor() |
while True: print("TCRT1000: value =", sense.getValue(0)) |
Java Example
Codeblock | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
import java.io.PrintStream; import org.deepjava.runtime.arm32.Task; import org.deepjava.runtime.zynq7000.driver. |
TCRT1000; import org.deepjava.runtime.zynq7000.driver.UART; public class TCRT1000Demo extends |
Task { static |
TCRT1000 |
sense; public |
void |
action() { |
for(int i = 0; i < 4; i++) { |
System.out.print(sense.read(i)); |
System.out.print('\t'); } System.out.println(); } static { |
UART |
uart |
= |
UART.getInstance(UART.pUART1); |
uart.start(115200, (short)0, (short)8); |
System.out = new PrintStream(uart.out); System.err = System.out; System.out.println("TCRT1000 demo"); // Initialize TCRT1000 driver for 4 sensors and start reading values sense = TCRT1000.getInstance(); |
sense.init(4, 4, 3, 2, 1, 0); // initialize 4 sensors sense.start(); // Create and install demo task Task demoTask = new TCRT1000Demo(); demoTask.period = 1000; Task.install(demoTask); } |
} |