// Adapted from: rx_tx01 Robert Hart Mar 2019. // Program to use transmit-receive across space between two conductors. // One conductor attached to pin D10, one to A0 // // // Signal varies with electric field coupling between conductors, and can // be used to measure many things related to position, overlap, and intervening material // between the two conductors. // int read_high; int read_low; int diff; void setup() { pinMode(D10,OUTPUT); //Pin D10 provides the voltage step Serial.begin(9600); } void loop() { digitalWrite(D10,HIGH); //Step the voltage high on conductor 1. read_high = analogRead(A0); //Measure response of conductor 2. delayMicroseconds(100); //Delay to reach steady state. digitalWrite(D10,LOW); //Step the voltage to zero on conductor 1. read_low = analogRead(A0); //Measure response of conductor 2. diff = read_high - read_low; //desired answer is the difference between high and low. Serial.println(diff); delay(100); }