12345678910111213141516171819202122232425262728293031323334 |
- #include <M5Stack.h>
- int sensorPin = 36;
- int last_sensorValue = 100;
- int cur_sensorValue = 0;
- void setup() {
- M5.begin();
- M5.Power.begin();
- pinMode(sensorPin, INPUT);
- dacWrite(25, 0);
- M5.Lcd.setTextSize(2);
- M5.Lcd.setCursor(0, 0);
- M5.Lcd.print("the value of ANGLE: ");
- }
- void loop() {
-
- cur_sensorValue = analogRead(sensorPin);
- M5.Lcd.setCursor(0, 25);
- if(abs(cur_sensorValue - last_sensorValue) > 10){
- M5.Lcd.fillRect(0, 25, 100, 25, BLACK);
- M5.Lcd.print(cur_sensorValue);
- last_sensorValue = cur_sensorValue;
- }
- delay(50);
- }
|