Skip to content

Commit

Permalink
Create T_Strip_Ardu.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshikerfuffle authored Apr 16, 2019
1 parent 25feb93 commit 469bb2a
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Triangle_Strip/T_Strip_Ardu.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//For ARDUINO

int ledPin = 7;
int potPin = A0;
int photoPin = A1;
int potOutput;
int photoReading;

void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
potOutput = analogRead(potPin);
photoReading = analogRead (photoPin);
// Serial.println(photoReading);

int mappedOutput = map(potOutput, 0, 1023, 0, 255); //map the output
// int mappedOutputB = map(photoReading, 0, 1023, 0, 255);

Serial.println(mappedOutput);
// Serial.println(mappedOutputB);

// Serial.write(mappedOutput);

if (Serial.available ( ) > 0) { // Checking if the Processing IDE has send a value or not
char state = Serial.read ( ); // Reading the data received and saving in the state variable

if (state == '1') { // If received data is '1', then turn on LED
digitalWrite (ledPin, HIGH);
}

if (state == '0') { // If received data is '0', then turn off led
digitalWrite (ledPin, LOW);
}
}

delay(50);
}

0 comments on commit 469bb2a

Please sign in to comment.