Skip to content
Snippets Groups Projects
Commit bb7428ff authored by Haruna's avatar Haruna
Browse files

pushed new

parent dae41ff0
No related merge requests found
No preview for this file type
// Code originally from http://www.instructables.com/id/Arduino-to-Processing-Serial-Communication-withou/
// by https://www.instructables.com/member/thelostspore/
// Code was shared under public domain https://creativecommons.org/licenses/publicdomain/
// This code reads analog inputs from pins A0 and A1 and sends these values out via serial
// You can add or remove pins to read from, but be sure they are separated by commas, and print a
// newline character at the end of each loop()
int AnalogPin0 = A0; //Declare an integer variable, hooked up to analog pin 0
int AnalogPin1 = A1; //Declare an integer variable, hooked up to analog pin 1
void setup() {
Serial.begin(9600); //Begin Serial Communication with a baud rate of 9600
}
void loop() {
//New variables are declared to store the readings of the respective pins
int Value1 = analogRead(AnalogPin0);
int Value2 = analogRead(AnalogPin1);
/*The Serial.print() function does not execute a "return" or a space
Also, the "," character is essential for parsing the values,
The comma is not necessary after the last variable.*/
Serial.print(Value1, DEC);
Serial.print(",");
Serial.print(Value2, DEC);
Serial.println();
//delay(500); // For illustration purposes only. This will slow down your program if not removed
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment