ARC 8-Channel IR sensor array coding

Hey, does anyone know how to read the analog inputs of the ARC 8-channel IR sensor array in the opmodes? Do we just have to use

power.readChannelVoltage(ADC_EXT_2) ?

1 Like

not sure probably power.readChannelVoltage(ADC_EXT_2) as you said

1 Like

Yes, `power.readChannelVoltage(ADC_EXT_2)` may be the right approach, provided `ADC_EXT_2` is the ADC input connected to one of the ARC-8 sensor outputs on your specific controller.

The ARC-8 is an 8-channel analog IR sensor array, so each sensor produces an analog voltage that must be read from its corresponding ADC channel.

### Example for an FTC-style OpMode

If your controller exposes the sensor outputs through individual ADC channels, you could use a pattern like this:

```java

double voltage = power.readChannelVoltage(ADC_EXT_2);

telemetry.addData(“IR Sensor 1”, voltage);

telemetry.update();

```

Important: This reads only one ADC channel. To read all eight sensors, you need to map each sensor output to its corresponding ADC input and read each one separately. Don’t assume `ADC_EXT_2` reads all eight channels.

1 Like

okay thanks a lot. any idea on how to read all the seperate 8 channels?

You’re welcome! :grinning_face_with_smiling_eyes: You can read all 8 channels by calling `readChannelVoltage()` separately for each ADC input, if your controller exposes eight individual ADC channels.

For example, the general pattern would be:

```java

double[] sensorValues = new double[8];

sensorValues[0] = power.readChannelVoltage(ADC_EXT_0);

sensorValues[1] = power.readChannelVoltage(ADC_EXT_1);

sensorValues[2] = power.readChannelVoltage(ADC_EXT_2);

// Continue for the remaining ADC channels

```

Then display the readings:

```java

for (int i = 0; i < 8; i++) {

telemetry.addData("IR Sensor " + i, sensorValues\[i\]);

}

telemetry.update();

```

1 Like

can anyone help us to generate file for autonomous code in opmode?

yeah. when u make a new opmode the first thing it asks you in teh wizard is whether you want to make an autonomous code or teleop. choose autonomous in that

1 Like

can anyone help us to connect ir sensor array to the hexa command hub?

i think its one of the analog 4 pin connectors. it is placed next to the motor driver cable

ONLY 5V, GND , sig pin connect with 5v, gnd and analog pin. no other pins (s2,s1,s0) connected

i dint understand this. pls ask this in the electronics tab as well