24 lines
345 B
C++
24 lines
345 B
C++
#include <SoftwareSerial.h>
|
|
|
|
SoftwareSerial mySerial(3,NULL); //RX, TX
|
|
|
|
uint8_t blueLED = 10;
|
|
uint8_t v;
|
|
void setup() {
|
|
|
|
mySerial.begin(9600);
|
|
pinMode(blueLED, OUTPUT);
|
|
digitalWrite(blueLED, LOW);
|
|
|
|
}
|
|
|
|
void loop() {
|
|
|
|
v = mySerial.read();
|
|
if (v == '1')
|
|
digitalWrite(blueLED, HIGH);
|
|
if (v == '2')
|
|
digitalWrite(blueLED, LOW);
|
|
|
|
}
|