27 lines
677 B
Arduino
27 lines
677 B
Arduino
|
#include <avr/pgmspace.h>
|
||
|
#include "stimulation_pattern.h"
|
||
|
|
||
|
const int stimulationPin = 5;
|
||
|
const int delayBetweenStimulations = 10; // milliseconds
|
||
|
|
||
|
void setup() {
|
||
|
pinMode(stimulationPin, OUTPUT);
|
||
|
Serial.begin(9600);
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
for (uint16_t i = 0; i < PATTERN_SIZE; i++) {
|
||
|
uint8_t stimulationValue = pgm_read_byte(&stimulation_pattern[i]);
|
||
|
analogWrite(stimulationPin, stimulationValue);
|
||
|
|
||
|
// Print the current stimulation value for debugging
|
||
|
Serial.print("Applying stimulation: ");
|
||
|
Serial.println(stimulationValue);
|
||
|
|
||
|
delay(delayBetweenStimulations);
|
||
|
}
|
||
|
|
||
|
// Add a longer delay at the end of each complete pattern
|
||
|
delay(1000);
|
||
|
}
|