Skip to content

Instantly share code, notes, and snippets.

@ttmarek
Created May 2, 2014 21:29
Show Gist options
  • Save ttmarek/6232f44bc41ee46fc914 to your computer and use it in GitHub Desktop.
Save ttmarek/6232f44bc41ee46fc914 to your computer and use it in GitHub Desktop.
Function to send serial data to a computer, for use with FunctionGenerator.ino
/* takeReading function
* takes in an analaog pin number as an integer
* sends serial data to PC to be read by Python
*/
void takeReading(int pinNum)
{
Serial.print(seconds,4);
Serial.print(',');
Serial.println(analogRead(pinNum));
}
/* takeTwoReadings function
* takes in two analaog pin numbers as an ints
* sends serial data to PC to be read by Python
*/
void takeTwoReadings(int pinOne, int pinTwo)
{
Serial.print(seconds,4);
Serial.print(',');
Serial.print(analogRead(pinOne));
Serial.print(',');
Serial.println(analogRead(pinTwo));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment