Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
M5StickC_3CH_ADC_BasicProgram
#include <M5StickC.h>
int PINX=33;
int PINY =36;
int PINZ=32;
int red=26;
int mVX[100];
int mVx;
int mVy;
int mVz;
void setup() {
M5.begin();
M5.Lcd.setRotation( 3 );
M5.Lcd.setTextSize(2);
M5.Lcd.setTextColor(0xFFE0);//Yellow
pinMode(PINX, ANALOG);
pinMode(PINY, ANALOG);
pinMode(PINZ, ANALOG);
//pinMode(red,INPUT_PULLUP);
}
void loop() {
M5.Lcd.fillScreen(BLACK);
i++;
mVx=analogRead(PINX);
mVy=analogRead(PINY);
mVz=analogRead(PINZ);
Serial.printf("%04d,%04d,%04d,%d\n\r",mVx,mVy,mVz,millis());
M5.Lcd.setCursor(0, 10);
M5.Lcd.printf("1Ch:%04d mV\n\r",mVx);
M5.Lcd.setCursor(0, 26);
M5.Lcd.printf("2Ch:%04d mV\n\r",mVy);
M5.Lcd.setCursor(0, 42);
M5.Lcd.printf("3Ch:%04d mV\n\r",mVz);
delay(8);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment