2022年6月6日星期一

ESP32 ADC Test

Use the sample code and use Serial Monitor as oscilloscope

//-----------------Sample Code---------------//

const int analogInPin = 4;  // Analog input pin that the potentiometer is attached to

int sensorValue = 0;        // value read from the pot


void setup() {

  // initialize serial communications at 9600 bps:

  Serial.begin(9600);

}

void loop() {

  // read the analog in value:

  sensorValue = analogRead(analogInPin);

  // map it to the range of the analog out:

  Serial.print(sensorValue);

}

//-----------------Sample Code End---------------//


1.Make sure the ADXL1001 voltage is 3.3V // Because ESP32 is 3.3V system

2.Use Serial Monitor to see the wave.



沒有留言:

發佈留言

打賞按讚