const int vertical=A0;
const int horizontal=A3;
void setup() {
// put your setup code here, to run once:
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
Serial.begin(115200);
Serial.println("Hello, ESP32!");
}
void loop() {
// put your main code here, to run repeatedly:
int adc_v,adc_h;
float v_volt,h_volt;
adc_v=analogRead(vertical);
adc_h=analogRead(horizontal);
v_volt=(( adc_v * 3.3 ) / 4095);
h_volt=(( adc_h * 3.3 ) / 4095);
Serial.print("v_volt= ");
Serial.print(v_volt);
Serial.print(" h_volt= ");
Serial.println(h_volt);
digitalWrite(2,v_volt);
digitalWrite(4,h_volt);
delay(1000); // this speeds up the simulation
}