Skip to content

Commit 687d40b

Browse files
committed
Added I2C scanner for debug + fixed diplay offset + add tone.
When pushing the button, output a tone. Show buzzer tone on screen.
1 parent cb7fbd7 commit 687d40b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

examples/Combined_Demo/Combined_Demo.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,25 @@ void loop() {
100100

101101
// when using u8g8 instead of u8g2, cursor values
102102
// are in characters, not pixels
103+
uint16_t pot_value = analogRead(pot);
104+
103105
Oled.setCursor(0, 0);
104106
Oled.print("But:");
107+
105108
if (digitalRead(button)) {
106109
digitalWrite(led, HIGH);
107110
Oled.print("1");
108-
tone(BUZZER, 440);
111+
tone(BUZZER, pot_value);
109112
} else {
110113
digitalWrite(led, LOW);
111114
Oled.print("0");
112115
noTone(BUZZER);
113116
}
114117

115-
uint16_t pot_value = analogRead(pot);
116118
Oled.setCursor(0, 1);
117-
Oled.print("Pot: ");
119+
Oled.print("BuzPot: ");
118120
Oled.print(pot_value);
119-
Oled.print(" ");
121+
Oled.print("Hz ");
120122

121123
uint16_t mic_value = analogRead(mic);
122124
Oled.setCursor(0, 2);

0 commit comments

Comments
 (0)