-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy patherika.ino
53 lines (44 loc) · 908 Bytes
/
erika.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
int inPin = 3;
void setup() {
// Open serial communications and wait for port to open:
pinMode(inPin, INPUT);
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(1200);
}
bool wait = false;
void loop() { // run over and over
int val = digitalRead(inPin);
Serial.println(val);
if(val == LOW && wait == false)
{
if (Serial.available()) {
mySerial.write(Serial.read());
}
wait = true;
}
else {
wait = false;
}
}
//char ddr2ascii(char val)
//{
// switch(val)
// {
// case "a":
// return "";
// case "b":
// return "";
// }
//}
//
//char ascii2ddr(char val)
//{
//}
//}