public static void AdcTest1(List <string> argsList, Tlc1543 adc) { Console.WriteLine($"ADC Test1"); List <Tlc1543.Channel> channelList = new List <Tlc1543.Channel> { Tlc1543.Channel.A0, Tlc1543.Channel.A1, Tlc1543.Channel.A2, Tlc1543.Channel.A3, Tlc1543.Channel.A4, Tlc1543.Channel.A10 }; double delay; if (argsList.Count > 1) { delay = Convert.ToDouble(argsList[1]); } else { delay = 10; } while (true) { List <int> values = adc.ReadChannels(channelList); //read data for (int i = 0; i < values.Count; i++) { Console.Write($"{i}: {values[i],4} "); } Thread.Sleep((int)delay); Console.WriteLine(); } }
/// <summary> /// Function providing sensors readout /// and calculating position of /// black line underneath the robot /// </summary> /// <returns> /// Decimal value ranging from -100 to 100 (left to right) /// <br>NaN means line was not found</br> /// </returns> public double?GetLineValue() { return(GetLineValue(adc.ReadChannels(channelList))); }