Created
October 11, 2020 14:19
-
-
Save dj1711572002/b1d0270c5174a770c8a5c26397ec3001 to your computer and use it in GitHub Desktop.
M5StickC_3CH_ADC_BasicProgram
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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