File tree Expand file tree Collapse file tree 2 files changed +82
-0
lines changed Expand file tree Collapse file tree 2 files changed +82
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < Ps3Controller.h>
2
+
3
+ bool stateIsConnected = false ;
4
+
5
+ void setup ()
6
+ {
7
+ Serial.begin (115200 );
8
+ Ps3.begin (" 01:02:03:04:05:06" );
9
+ Serial.println (" Ready." );
10
+ }
11
+
12
+ void loop ()
13
+ {
14
+ if (stateIsConnected == false ){
15
+
16
+ if (Ps3.isConnected ()){
17
+ delay (250 ); // ToDo: the ps3 library should handle this delay
18
+ Ps3.setLed (1 ); // ToDo: the ps3 library should set LED 1 on connect by default
19
+ stateIsConnected = true ;
20
+ }
21
+
22
+ }else {
23
+
24
+ if ( Ps3.data .button .cross ){
25
+ Serial.println (" Pressing the cross button" );
26
+ }
27
+
28
+ if ( Ps3.data .button .square ){
29
+ Serial.println (" Pressing the square button" );
30
+ }
31
+
32
+ if ( Ps3.data .button .triangle ){
33
+ Serial.println (" Pressing the triangle button" );
34
+ }
35
+
36
+ if ( Ps3.data .button .circle ){
37
+ Serial.println (" Pressing the circle button" );
38
+ }
39
+
40
+ }
41
+ }
Original file line number Diff line number Diff line change
1
+ #include < Ps3Controller.h>
2
+
3
+ bool stateIsConnected = false ;
4
+
5
+ void notify ()
6
+ {
7
+ if ( Ps3.data .button .cross ){
8
+ Serial.println (" Pressing the cross button" );
9
+ }
10
+
11
+ if ( Ps3.data .button .square ){
12
+ Serial.println (" Pressing the square button" );
13
+ }
14
+
15
+ if ( Ps3.data .button .triangle ){
16
+ Serial.println (" Pressing the triangle button" );
17
+ }
18
+
19
+ if ( Ps3.data .button .circle ){
20
+ Serial.println (" Pressing the circle button" );
21
+ }
22
+ }
23
+
24
+ void setup ()
25
+ {
26
+ Serial.begin (115200 );
27
+ Ps3.attach (notify);
28
+ Ps3.begin (" 01:02:03:04:05:06" );
29
+ Serial.println (" Ready." );
30
+ }
31
+
32
+ void loop ()
33
+ {
34
+ if (stateIsConnected == false ){
35
+ if (Ps3.isConnected ()){
36
+ delay (250 ); // ToDo: the ps3 library should handle this delay
37
+ Ps3.setLed (1 ); // ToDo: the ps3 library should set LED 1 on connect by default
38
+ stateIsConnected = true ;
39
+ }
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments