forked from pdbuzzboard/pdbuzzboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VibroTherapy 3V.ino
56 lines (32 loc) · 1.26 KB
/
VibroTherapy 3V.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
Vibrotherapy sketch to drive 4 finger motors according to pattern from Coordinated Reset Vibrotacti
Stimulation article by Peter A. Tass et. al April, 2021
Arrays
created 2006
by David A. Mellis
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
http:https://www.arduino.cchttps://www.arduino.cc/en/Tutorial/Array
*/
int timer = 100; // The higher the number, the slower the timing.
int ledPins[] = { 7, 5, 9, 3, 3, 5, 9, 7, 5, 9, 7, 3, 13, 13, 13, 13, 13, 13, 13, 13, 5, 9, 7, 3, 5, 3, 7, 9, 3, 7, 9, 5 };
// an array of pin numbers to which LEDs are attached Pin 13 is a pause
int pinCount = 32; // the number of pins (i.e. the length of the array)
void setup() {
// the array elements are numbered from 0 to (pinCount - 1).
// use a for loop to initialize each pin as an output:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
pinMode(ledPins[thisPin], OUTPUT);
}
}
void loop() {
// loop from the lowest pin to the highest:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
// turn the pin off - motor on: assumes npn transistor
digitalWrite(ledPins[thisPin], HIGH);
delay(timer);
// turn the pin on - motor off:
digitalWrite(ledPins[thisPin], LOW);
}
}