We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73bfcfa commit b7563bbCopy full SHA for b7563bb
examples/EncoderSetter/EncoderSetter.ino
@@ -0,0 +1,18 @@
1
+#include "Modulino.h"
2
+
3
+ModulinoKnob encoder;
4
5
+void setup() {
6
+ // put your setup code here, to run once:
7
+ Serial.begin(115200);
8
+ Modulino.begin();
9
+ encoder.begin();
10
+}
11
12
+void loop() {
13
+ int value = encoder.get();
14
+ if (value > 7 || value < 0) {
15
+ encoder.set(0);
16
+ }
17
+ Serial.println(value);
18
src/Modulino.h
@@ -230,6 +230,11 @@ class ModulinoKnob : public Module {
230
int16_t ret = buf[0] | (buf[1] << 8);
231
return ret;
232
}
233
+ void set(int16_t value) {
234
+ uint8_t buf[4];
235
+ memcpy(buf, &value, 2);
236
+ write(buf, 4);
237
238
bool pressed() {
239
get();
240
return _pressed;
0 commit comments