Main Site Documentation

Touchpanel extension for Cobra


#1

Does anyone know why R1 and R2 are pulling down the analog touchpanel signal in this schematic: http://www.ghielectronics.com/downloads/FEZ/Cobra/FEZ-TFT%20EXP_sch.pdf ?

I’m trying to find a way of measuring the touch pressure. But those resistors seem to have a bad effect on the measurements, can I remove them?


#2

We somewhat cheat and use the built in ADC so those are needed.


#3

I already managed to read out coordinates. But I’ll have to do some calculations on how to calculate the touch resistance, and those pull-downs don’t make it easier :slight_smile:

But I understand that they are needed to define a non-touched state.


        public static int ReadX()
        {
            using (AnalogIn yu = new AnalogIn((AnalogIn.Pin)1))
            {
                using (OutputPort xl = new OutputPort((Cpu.Pin)8, true))
                using (OutputPort xr = new OutputPort((Cpu.Pin)72, false))
                {
                    return yu.Read();
                }
            }
        }

        public static int ReadY()
        {
            using (AnalogIn xl = new AnalogIn((AnalogIn.Pin)0))
            {
                using (OutputPort yu = new OutputPort((Cpu.Pin)5, true))
                using (OutputPort yd = new OutputPort((Cpu.Pin)73, false))
                {
                    return xl.Read();                    
                }
            }
        }

        public static int ReadZ1()
        {
            using (AnalogIn xl = new AnalogIn((AnalogIn.Pin)0))
            {
                using (OutputPort xr = new OutputPort((Cpu.Pin)72, false))
                using (OutputPort yu = new OutputPort((Cpu.Pin)73, true))
                {
                    return xl.Read();
                }
            }
        }