Skip to content

Instantly share code, notes, and snippets.

@dj1711572002
Created October 11, 2020 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dj1711572002/b1d0270c5174a770c8a5c26397ec3001 to your computer and use it in GitHub Desktop.
Save dj1711572002/b1d0270c5174a770c8a5c26397ec3001 to your computer and use it in GitHub Desktop.
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