45 lines
785 B
C++
45 lines
785 B
C++
#include "twinmax.h"
|
|
|
|
SSD1306AsciiWire oled;
|
|
Pressure pleft;
|
|
Pressure pright;
|
|
PushButton btn;
|
|
Potentiometer slider;
|
|
|
|
void setup()
|
|
{
|
|
Wire.begin();
|
|
Wire.setClock(400000L);
|
|
|
|
pleft.setup(PRESSURE_LEFT);
|
|
pright.setup(PRESSURE_RIGHT);
|
|
btn.setup(PUSH_BTN_PIN);
|
|
slider.setup(POTENTIOMETER_PIN);
|
|
|
|
Serial.begin(9600);
|
|
|
|
oled.begin(&Adafruit128x32, DISP_ADDR);
|
|
oled.clear();
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
if( btn.tap() ){
|
|
mode = (mode == RELATIVE) ? ABSOLUTE : RELATIVE;
|
|
}
|
|
|
|
oled.clear();
|
|
oled.setFont();
|
|
if( mode == RELATIVE ) oled.println(" relative ");
|
|
if( mode == ABSOLUTE ) oled.println(" absolute ");
|
|
|
|
|
|
oled.setFont(Callibri11);
|
|
oled.print(slider.range());
|
|
oled.print(": ");
|
|
oled.print(pleft.value()); oled.print("-");
|
|
oled.println(pright.value());
|
|
|
|
delay(100);
|
|
}
|