Skip to content

Instantly share code, notes, and snippets.

@CalvinLogan
Last active May 24, 2021 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CalvinLogan/d613a76ea293bd052147b7b8b01e89fd to your computer and use it in GitHub Desktop.
Save CalvinLogan/d613a76ea293bd052147b7b8b01e89fd to your computer and use it in GitHub Desktop.
//inputs
int slidePin = A2;
int potPin1 = A1;
int potPin2 = A0;
int buttonPin = 12;
//outputs
int LEDR1 = 11;
int LEDR2 = 10;
int LEDR3 = 9;
int LEDL1 = 6;
int LEDL2 = 5;
int LEDL3 = 17;
void setup() {
Serial.begin(9600); //opening our Serial pathway
//declaring outputs
pinMode(LEDR1, OUTPUT);
pinMode(LEDR2, OUTPUT);
pinMode(LEDR3, OUTPUT);
pinMode(LEDL1, OUTPUT);
pinMode(LEDL2, OUTPUT);
pinMode(LEDL3, OUTPUT);
}
void loop() {
//readings from the input pins
int slide = analogRead(slidePin);
int pot1 = analogRead(potPin1);
int pot2 = analogRead(potPin2);
int button = digitalRead(buttonPin);
//sends sensor values to P5
Serial.print(slide);
Serial.print(",");
Serial.print(pot1);
Serial.print(",");
Serial.print(pot2);
Serial.print(",");
Serial.println(button);
delay(10); // delay in between reads for stability
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment