-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvoiture_radio_TX.ino
68 lines (65 loc) · 1.37 KB
/
voiture_radio_TX.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int JoyStick_X = A0; //x
int JoyStick_Y = A1; //y
void setup() {
mySwitch.enableTransmit(10);
Serial.begin(9600);
}
void loop() {
int x, y;
x = analogRead(JoyStick_X);
y = analogRead(JoyStick_Y);
Serial.println(x);
Serial.println(y);
if (x < 350) {
mySwitch.send((999000), 23);
}
if (x > 650) {
mySwitch.send((888000), 24);
}
if (y < 350) {
mySwitch.send((777000), 24);
}
if (y > 640) {
mySwitch.send((666000), 24);
}
if (x > 351 && x < 649 || y > 351 && y < 639) {
mySwitch.send((555000), 24);
}
}
*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int JoyStick_X = PA0; //x
int JoyStick_Y = PA1; //y
void setup() {
mySwitch.enableTransmit(PA10);
Serial.begin(9600);
}
void loop() {
int x, y;
x = analogRead(JoyStick_X) / 8;
y = analogRead(JoyStick_Y) / 8;
mySwitch.send((999000 + x), 24);
mySwitch.send((888000 + y), 24);
//Serial.print(x);
Serial.println(y);
}
/*#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int JoyStick_X = A0; //x
int JoyStick_Y = A1; //y
void setup() {
mySwitch.enableTransmit(10);
Serial.begin(9600);
}
void loop() {
int x, y;
x = analogRead(JoyStick_X) / 2;
y = analogRead(JoyStick_Y) / 2;
mySwitch.send((999000 + x), 24);
mySwitch.send((888000 + y), 24);
//Serial.print(x);
Serial.println(y);
}*/