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