brix5 / firmware / demo / FeatherBase-DRV2605-Realtime / FeatherBase-DRV2605-Realtime.ino @ a2a2cf8b
History | View | Annotate | Download (601 Bytes)
1 | 00e852cf | Jan | #include <Wire.h> |
---|---|---|---|
2 | #include "Adafruit_DRV2605.h" |
||
3 | |||
4 | Adafruit_DRV2605 drv; |
||
5 | |||
6 | void setup() { |
||
7 | Serial.begin(9600); |
||
8 | Serial.println("DRV test"); |
||
9 | pinMode(A1, OUTPUT); |
||
10 | digitalWrite(A1, HIGH); |
||
11 | drv.begin(); |
||
12 | |||
13 | // We use an LRA, not an ERM |
||
14 | drv.selectLibrary(6); |
||
15 | drv.useLRA(); |
||
16 | |||
17 | // Set Real-Time Playback mode |
||
18 | drv.setMode(DRV2605_MODE_REALTIME); |
||
19 | } |
||
20 | |||
21 | void loop() { |
||
22 | for (int intensity 0; intensity <= 127; intensity += 8) { |
||
23 | drv.setRealtimeValue(intensity); |
||
24 | delay(200); |
||
25 | } |
||
26 | for (int intensity 127; intensity >= 0; intensity -= 8) { |
||
27 | drv.setRealtimeValue(intensity); |
||
28 | delay(200); |
||
29 | } |
||
30 | } |