Skip to content

Commit 5905c1d

Browse files
authored
Merge pull request #60 from biomurph/master
Added support for more STM32 Boards
2 parents 8a7d4b3 + b56fad9 commit 5905c1d

File tree

10 files changed

+125
-124
lines changed

10 files changed

+125
-124
lines changed

examples/PulseSensor_BPM/PulseSensor_BPM.ino

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ const int OUTPUT_TYPE = SERIAL_PLOTTER;
4242

4343
/*
4444
Pinout:
45-
PIN_INPUT = Analog Input. Connected to the pulse sensor
45+
PULSE_INPUT = Analog Input. Connected to the pulse sensor
4646
purple (signal) wire.
47-
PIN_BLINK = digital Output. Connected to an LED (and 220 ohm resistor)
47+
PULSE_BLINK = digital Output. Connected to an LED (and 220 ohm resistor)
4848
that will flash on each detected pulse.
49-
PIN_FADE = digital Output. PWM pin onnected to an LED (and resistor)
49+
PULSE_FADE = digital Output. PWM pin onnected to an LED (and resistor)
5050
that will smoothly fade with each pulse.
51-
NOTE: PIN_FADE must be a pin that supports PWM. Do not use
51+
NOTE: PULSE_FADE must be a pin that supports PWM. Do not use
5252
pin 9 or 10, because those pins' PWM interferes with the sample timer.
5353
*/
54-
const int PIN_INPUT = A0;
55-
const int PIN_BLINK = 13; // Pin 13 is the on-board LED
56-
const int PIN_FADE = 5;
54+
const int PULSE_INPUT = A0;
55+
const int PULSE_BLINK = 13; // Pin 13 is the on-board LED
56+
const int PULSE_FADE = 5;
5757
const int THRESHOLD = 550; // Adjust this number to avoid noise when idle
5858

5959
/*
@@ -75,9 +75,9 @@ void setup() {
7575

7676
// Configure the PulseSensor manager.
7777

78-
pulseSensor.analogInput(PIN_INPUT);
79-
pulseSensor.blinkOnPulse(PIN_BLINK);
80-
pulseSensor.fadeOnPulse(PIN_FADE);
78+
pulseSensor.analogInput(PULSE_INPUT);
79+
pulseSensor.blinkOnPulse(PULSE_BLINK);
80+
pulseSensor.fadeOnPulse(PULSE_FADE);
8181

8282
pulseSensor.setSerial(Serial);
8383
pulseSensor.setOutputType(OUTPUT_TYPE);
@@ -95,9 +95,9 @@ void setup() {
9595
*/
9696
for(;;) {
9797
// Flash the led to show things didn't work.
98-
digitalWrite(PIN_BLINK, LOW);
98+
digitalWrite(PULSE_BLINK, LOW);
9999
delay(50);
100-
digitalWrite(PIN_BLINK, HIGH);
100+
digitalWrite(PULSE_BLINK, HIGH);
101101
delay(50);
102102
}
103103
}

examples/PulseSensor_BPM_Alternative/PulseSensor_BPM_Alternative.ino

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ const int OUTPUT_TYPE = SERIAL_PLOTTER;
5454

5555
/*
5656
Pinout:
57-
PIN_INPUT = Analog Input. Connected to the pulse sensor
57+
PULSE_INPUT = Analog Input. Connected to the pulse sensor
5858
purple (signal) wire.
59-
PIN_BLINK = digital Output. Connected to an LED (and 220 ohm resistor)
59+
PULSE_BLINK = digital Output. Connected to an LED (and 220 ohm resistor)
6060
that will flash on each detected pulse.
61-
PIN_FADE = digital Output. PWM pin onnected to an LED (and resistor)
61+
PULSE_FADE = digital Output. PWM pin onnected to an LED (and resistor)
6262
that will smoothly fade with each pulse.
63-
NOTE: PIN_FADE must be a pin that supports PWM.
64-
If USE_INTERRUPTS is true, Do not use pin 9 or 10 for PIN_FADE,
63+
NOTE: PULSE_FADE must be a pin that supports PWM.
64+
If USE_INTERRUPTS is true, Do not use pin 9 or 10 for PULSE_FADE,
6565
because those pins' PWM interferes with the sample timer.
6666
*/
67-
const int PIN_INPUT = A0;
68-
const int PIN_BLINK = 13; // Pin 13 is the on-board LED
69-
const int PIN_FADE = 5;
67+
const int PULSE_INPUT = A0;
68+
const int PULSE_BLINK = 13; // Pin 13 is the on-board LED
69+
const int PULSE_FADE = 5;
7070
const int THRESHOLD = 550; // Adjust this number to avoid noise when idle
7171

7272
/*
@@ -98,9 +98,9 @@ void setup() {
9898
Serial.begin(115200);
9999

100100
// Configure the PulseSensor manager.
101-
pulseSensor.analogInput(PIN_INPUT);
102-
pulseSensor.blinkOnPulse(PIN_BLINK);
103-
pulseSensor.fadeOnPulse(PIN_FADE);
101+
pulseSensor.analogInput(PULSE_INPUT);
102+
pulseSensor.blinkOnPulse(PULSE_BLINK);
103+
pulseSensor.fadeOnPulse(PULSE_FADE);
104104

105105
pulseSensor.setSerial(Serial);
106106
pulseSensor.setOutputType(OUTPUT_TYPE);
@@ -120,9 +120,9 @@ void setup() {
120120
*/
121121
for(;;) {
122122
// Flash the led to show things didn't work.
123-
digitalWrite(PIN_BLINK, LOW);
123+
digitalWrite(PULSE_BLINK, LOW);
124124
delay(50);
125-
digitalWrite(PIN_BLINK, HIGH);
125+
digitalWrite(PULSE_BLINK, HIGH);
126126
delay(50);
127127
}
128128
}

examples/PulseSensor_PTT/PulseSensor_PTT.ino

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,29 @@ const int OUTPUT_TYPE = PROCESSING_VISUALIZER;
5959
const int PULSE_SENSOR_COUNT = 2;
6060

6161
/*
62-
PIN_POWERx = the output pin that the red (power) pin of
62+
PULSE_POWERx = the output pin that the red (power) pin of
6363
the first PulseSensor will be connected to. PulseSensor only
6464
draws about 4mA, so almost any micro can power it from a GPIO.
6565
If you don't want to use pins to power the PulseSensors, you can remove
66-
the code dealing with PIN_POWER0 and PIN_POWER1.
67-
PIN_INPUTx = Analog Input. Connected to the pulse sensor
66+
the code dealing with PULSE_POWER0 and PULSE_POWER1.
67+
PULSE_INPUTx = Analog Input. Connected to the pulse sensor
6868
purple (signal) wire.
69-
PIN_BLINKx = digital Output. Connected to an LED (must have at least
69+
PULSE_BLINKx = digital Output. Connected to an LED (must have at least
7070
470 ohm resistor) that will flash on each detected pulse.
71-
PIN_FADEx = digital Output. PWM pin onnected to an LED (must have
71+
PULSE_FADEx = digital Output. PWM pin onnected to an LED (must have
7272
at least 470 ohm resistor) that will smoothly fade with each pulse.
7373
74-
NOTE: PIN_FADEx must be pins that support PWM.
75-
If USE_INTERRUPTS is true, Do not use pin 9 or 10 for PIN_FADEx
74+
NOTE: PULSE_FADEx must be pins that support PWM.
75+
If USE_INTERRUPTS is true, Do not use pin 9 or 10 for PULSE_FADEx
7676
because those pins' PWM interferes with the sample timer.
7777
*/
78-
const int PIN_INPUT0 = A0;
79-
const int PIN_BLINK0 = 13; // Pin 13 is the on-board LED
80-
const int PIN_FADE0 = 5;
78+
const int PULSE_INPUT0 = A0;
79+
const int PULSE_BLINK0 = 13; // Pin 13 is the on-board LED
80+
const int PULSE_FADE0 = 5;
8181

82-
const int PIN_INPUT1 = A1;
83-
const int PIN_BLINK1 = 12;
84-
const int PIN_FADE1 = 11;
82+
const int PULSE_INPUT1 = A1;
83+
const int PULSE_BLINK1 = 12;
84+
const int PULSE_FADE1 = 11;
8585

8686
const int THRESHOLD = 550; // Adjust this number to avoid noise when idle
8787

@@ -117,13 +117,13 @@ void setup() {
117117
we're configuring.
118118
*/
119119

120-
pulseSensor.analogInput(PIN_INPUT0, 0);
121-
pulseSensor.blinkOnPulse(PIN_BLINK0, 0);
122-
pulseSensor.fadeOnPulse(PIN_FADE0, 0);
120+
pulseSensor.analogInput(PULSE_INPUT0, 0);
121+
pulseSensor.blinkOnPulse(PULSE_BLINK0, 0);
122+
pulseSensor.fadeOnPulse(PULSE_FADE0, 0);
123123

124-
pulseSensor.analogInput(PIN_INPUT1, 1);
125-
pulseSensor.blinkOnPulse(PIN_BLINK1, 1);
126-
pulseSensor.fadeOnPulse(PIN_FADE1, 1);
124+
pulseSensor.analogInput(PULSE_INPUT1, 1);
125+
pulseSensor.blinkOnPulse(PULSE_BLINK1, 1);
126+
pulseSensor.fadeOnPulse(PULSE_FADE1, 1);
127127

128128
pulseSensor.setSerial(Serial);
129129
pulseSensor.setOutputType(OUTPUT_TYPE);
@@ -141,9 +141,9 @@ void setup() {
141141
*/
142142
for (;;) {
143143
// Flash the led to show things didn't work.
144-
digitalWrite(PIN_BLINK0, LOW);
144+
digitalWrite(PULSE_BLINK0, LOW);
145145
delay(50);
146-
digitalWrite(PIN_BLINK0, HIGH);
146+
digitalWrite(PULSE_BLINK0, HIGH);
147147
delay(50);
148148
}
149149
}

examples/PulseSensor_Servo/PulseSensor_Servo.ino

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ const int OUTPUT_TYPE = SERIAL_PLOTTER;
4848

4949
/*
5050
Pinout:
51-
PIN_INPUT = Analog Input. Connected to the pulse sensor
51+
PULSE_INPUT = Analog Input. Connected to the pulse sensor
5252
purple (signal) wire.
53-
PIN_BLINK = digital Output. Connected to an LED (and 220 ohm resistor)
53+
PULSE_BLINK = digital Output. Connected to an LED (and 220 ohm resistor)
5454
that will flash on each detected pulse.
55-
PIN_FADE = digital Output. PWM pin onnected to an LED (and resistor)
55+
PULSE_FADE = digital Output. PWM pin onnected to an LED (and resistor)
5656
that will smoothly fade with each pulse.
57-
NOTE: PIN_FADE must be a pin that supports PWM. Do not use
57+
NOTE: PULSE_FADE must be a pin that supports PWM. Do not use
5858
pin 9 or 10, because those pins' PWM interferes with the sample timer.
5959
*/
60-
const int PIN_INPUT = A0;
61-
const int PIN_BLINK = 13; // Pin 13 is the on-board LED
62-
const int PIN_FADE = 5;
60+
const int PULSE_INPUT = A0;
61+
const int PULSE_BLINK = 13; // Pin 13 is the on-board LED
62+
const int PULSE_FADE = 5;
6363
const int THRESHOLD = 550; // Adjust this number to avoid noise when idle
6464

6565
/*
@@ -85,15 +85,15 @@ void setup() {
8585
not work properly.
8686
*/
8787
Serial.begin(115200);
88-
// set up the heart servo on SERVO_PIN
88+
// set up the heart servo on SERVO_PULSE
8989
// set servo position to pos (90 degrees, mid position)
9090
heart.attach(SERVO_PIN);
9191
heart.write(pos);
9292

9393
// Configure the PulseSensor manager.
94-
pulseSensor.analogInput(PIN_INPUT);
95-
pulseSensor.blinkOnPulse(PIN_BLINK);
96-
pulseSensor.fadeOnPulse(PIN_FADE);
94+
pulseSensor.analogInput(PULSE_INPUT);
95+
pulseSensor.blinkOnPulse(PULSE_BLINK);
96+
pulseSensor.fadeOnPulse(PULSE_FADE);
9797

9898
pulseSensor.setSerial(Serial);
9999
pulseSensor.setOutputType(OUTPUT_TYPE);
@@ -111,9 +111,9 @@ void setup() {
111111
*/
112112
for(;;) {
113113
// Flash the led to show things didn't work.
114-
digitalWrite(PIN_BLINK, LOW);
114+
digitalWrite(PULSE_BLINK, LOW);
115115
delay(50);
116-
digitalWrite(PIN_BLINK, HIGH);
116+
digitalWrite(PULSE_BLINK, HIGH);
117117
delay(50);
118118
}
119119
}

examples/PulseSensor_Speaker/PulseSensor_Speaker.ino

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ const int OUTPUT_TYPE = SERIAL_PLOTTER;
4545

4646
/*
4747
Pinout:
48-
PIN_INPUT = Analog Input. Connected to the pulse sensor
48+
PULSE_INPUT = Analog Input. Connected to the pulse sensor
4949
purple (signal) wire.
50-
PIN_BLINK = digital Output. Connected to an LED (and 220 ohm resistor)
50+
PULSE_BLINK = digital Output. Connected to an LED (and 220 ohm resistor)
5151
that will flash on each detected pulse.
52-
PIN_FADE = digital Output. PWM pin onnected to an LED (and resistor)
52+
PULSE_FADE = digital Output. PWM pin onnected to an LED (and resistor)
5353
that will smoothly fade with each pulse.
54-
NOTE: PIN_FADE must be a pin that supports PWM. Do not use
54+
NOTE: PULSE_FADE must be a pin that supports PWM. Do not use
5555
pin 9 or 10, because those pins' PWM interferes with the sample timer.
5656
*/
57-
const int PIN_INPUT = A0;
58-
const int PIN_BLINK = 13; // Pin 13 is the on-board LED
59-
const int PIN_FADE = 5;
57+
const int PULSE_INPUT = A0;
58+
const int PULSE_BLINK = 13; // Pin 13 is the on-board LED
59+
const int PULSE_FADE = 5;
6060
const int THRESHOLD = 550; // Adjust this number to avoid noise when idle
6161

6262
/*
@@ -90,9 +90,9 @@ void setup() {
9090

9191
// Configure the PulseSensor manager.
9292

93-
pulseSensor.analogInput(PIN_INPUT);
94-
pulseSensor.blinkOnPulse(PIN_BLINK);
95-
pulseSensor.fadeOnPulse(PIN_FADE);
93+
pulseSensor.analogInput(PULSE_INPUT);
94+
pulseSensor.blinkOnPulse(PULSE_BLINK);
95+
pulseSensor.fadeOnPulse(PULSE_FADE);
9696

9797
pulseSensor.setSerial(Serial);
9898
pulseSensor.setOutputType(OUTPUT_TYPE);
@@ -110,9 +110,9 @@ void setup() {
110110
*/
111111
for(;;) {
112112
// Flash the led to show things didn't work.
113-
digitalWrite(PIN_BLINK, LOW);
113+
digitalWrite(PULSE_BLINK, LOW);
114114
delay(50);
115-
digitalWrite(PIN_BLINK, HIGH);
115+
digitalWrite(PULSE_BLINK, HIGH);
116116
delay(50);
117117
}
118118
}

examples/SoftwareSerialDemo/SoftwareSerialDemo.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ const int OUTPUT_TYPE = SERIAL_PLOTTER;
4646
const int PIN_RX = 7;
4747
const int PIN_TX = 8;
4848

49-
const int PIN_INPUT = A0;
50-
const int PIN_BLINK = 13; // Pin 13 is the on-board LED
51-
const int PIN_FADE = 5; // Must be a PWM pin other than 9 or 10.
49+
const int PULSE_INPUT = A0;
50+
const int PULSE_BLINK = 13; // Pin 13 is the on-board LED
51+
const int PULSE_FADE = 5; // Must be a PWM pin other than 9 or 10.
5252
const int THRESHOLD = 550; // Adjust this number to avoid noise when idle
5353

5454
/*
@@ -64,9 +64,9 @@ void setup() {
6464

6565
// Configure the PulseSensor manager.
6666

67-
pulseSensor.analogInput(PIN_INPUT);
68-
pulseSensor.blinkOnPulse(PIN_BLINK);
69-
pulseSensor.fadeOnPulse(PIN_FADE);
67+
pulseSensor.analogInput(PULSE_INPUT);
68+
pulseSensor.blinkOnPulse(PULSE_BLINK);
69+
pulseSensor.fadeOnPulse(PULSE_FADE);
7070

7171
pulseSensor.setSerial(ourSerial);
7272
pulseSensor.setOutputType(OUTPUT_TYPE);
@@ -82,9 +82,9 @@ void setup() {
8282
*/
8383
for(;;) {
8484
// Flash the led to show things didn't work.
85-
digitalWrite(PIN_BLINK, LOW);
85+
digitalWrite(PULSE_BLINK, LOW);
8686
delay(50);
87-
digitalWrite(PIN_BLINK, HIGH);
87+
digitalWrite(PULSE_BLINK, HIGH);
8888
delay(50);
8989
}
9090
}

0 commit comments

Comments
 (0)