Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Arduino IDE: | ||
// File -> Examples -> 04.Communication -> PhysicalPixel | ||
|
||
const int ledPin = 13; // pin the LED is attached to | ||
int incomingByte; // variable stores serial data | ||
|
||
void setup() { | ||
// initialize serial communication: | ||
Serial.begin(9600); | ||
// initialize the LED pin as an output: | ||
pinMode(ledPin, OUTPUT); | ||
} | ||
|
||
void loop() { | ||
// see if there's incoming serial data: | ||
if (Serial.available() > 0) { | ||
// read the oldest byte in the serial buffer: | ||
incomingByte = Serial.read(); | ||
// if it's a capital H (ASCII 72), turn on the LED: | ||
if (incomingByte == 'H') { | ||
digitalWrite(ledPin, HIGH); | ||
Serial.println("Getting H"); //print out to serial monitor to check state | ||
} | ||
// if it's an L (ASCII 76) turn off the LED: | ||
if (incomingByte == 'L') { | ||
digitalWrite(ledPin, LOW); | ||
Serial.println("Getting L"); //print out to serial monitor to check state | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.