#define PIN_capacitorPlate_Input 2 // can be digital because it's whether ON/OFF #define PIN_capacitorPlate_ReadOut 4 //must be an analog pin to give a continuous readout void setup() { // put your setup code here, to run once: SerialUSB.begin(0); pinMode (PIN_capacitorPlate_Input, OUTPUT); //output form the microcontroller pinMode (PIN_capacitorPlate_ReadOut, INPUT); //input to microcontroller } void loop() { // put your main code here, to run repeatedly: digitalWrite(PIN_capacitorPlate_Input, LOW); //set the value of the pin to low, no charging happening delay (150); //15ms, long discharge digitalWrite(PIN_capacitorPlate_Input, HIGH); //Iput plates should be charging delayMicroseconds (10); //readout V will always be smaller than 3.3V, analogread defaults to comparing values to V= 3.3V int bucket_num = analogRead(PIN_capacitorPlate_ReadOut); Serial.println(bucket_num); delay(150); }