Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Here's code for the AD8232 Heart Rate Monitor Kit that sends ECG data to the Serial Plotter:
- After uploading the code to your Arduino board, open the Serial Plotter from the Arduino IDE by going to "Tools" > "Serial Plotter". You'll see the ECG graph in real-time. Adjust the delay in the loop() function to change the sampling rate.
- Note that the Serial Plotter in the Arduino IDE is a basic tool for visualizing data. If you need more advanced features or want to store the ECG data for further analysis, consider using a more powerful plotting software like Processing or sending the data to a web server and plotting it using JavaScript libraries like Chart.js or Plotly.js.
- */
- // Define the pin connections
- const int AD8232_LO_PLUS = 2;
- const int AD8232_LO_MINUS = 3;
- const int AD8232_OUTPUT = A0;
- void setup() {
- Serial.begin(9600);
- pinMode(AD8232_LO_PLUS, INPUT);
- pinMode(AD8232_LO_MINUS, INPUT);
- pinMode(AD8232_OUTPUT, INPUT);
- }
- void loop() {
- int LO_plus = digitalRead(AD8232_LO_PLUS);
- int LO_minus = digitalRead(AD8232_LO_MINUS);
- if (LO_plus == 1 || LO_minus == 1) {
- Serial.println("Leads Off");
- } else {
- int output = analogRead(AD8232_OUTPUT);
- Serial.println(output);
- }
- delay(5); // Adjust the delay for different sampling rates
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement