Skip to content

Instantly share code, notes, and snippets.

@giljr
Created April 23, 2017 00:34
Show Gist options
  • Save giljr/d3d070483fbd49eac28efb5389524f8b to your computer and use it in GitHub Desktop.
Save giljr/d3d070483fbd49eac28efb5389524f8b to your computer and use it in GitHub Desktop.
See this post, please: https://goo.gl/ltXjBC
#include <FlexiTimer2.h> // use timer for sampling to get even time base for data
const int READ_A0_PIN = A0;
const int READ_A1_PIN = A1;
const int READ_A2_PIN = A2;
int inverted_value = 0;
void setup() {
Serial.begin(115200); // initialize serial communications (to match that used by PlotNValues.pde)
pinMode(READ_A0_PIN, INPUT);
pinMode(READ_A1_PIN, INPUT);
pinMode(READ_A2_PIN, INPUT);
FlexiTimer2::set(10, sample);
FlexiTimer2::start();
}
void loop() {
//wait interruptions
}
// sample values and pipe to processing
void sample() {
String result = "";
Serial.println(result + analogRead(READ_A0_PIN) + "," + analogRead(READ_A1_PIN) + "," + analogRead(READ_A2_PIN));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment