Untitled
unknown
c_cpp
5 months ago
732 B
3
Indexable
#include <M5Stack.h> int last_sensorValue = 2048; // Предыдущие показания датчика int cur_sensorValue = 0; // Текущие показания датчика int zvuk = 0; // Частота, которую будем воспроизводить void setup() { M5.begin(); M5.Power.begin(); pinMode(36, INPUT); M5.Lcd.setTextSize(2); } void loop() { cur_sensorValue = analogRead(36); M5.Lcd.setCursor(0, 25); zvuk = map(cur_sensorValue, 0, 4095, 262, 494); M5.Lcd.print("UGOL: "); M5.Lcd.print(cur_sensorValue); M5.Lcd.print("ZVUK: "); M5.Lcd.print(zvuk); M5.Speaker.tone(zvuk); last_sensorValue = cur_sensorValue; delay(50); }
Editor is loading...
Leave a Comment