Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.99 KB | None | 0 0
  1. #define MAX_RESET 7 //MAX3421E pin 12
  2. #define MAX_GPX   8 //MAX3421E pin 17
  3.  
  4. #include <PS3USB.h>
  5.  
  6. USB Usb;
  7. /* You can create the instance of the class in two ways */
  8. PS3USB PS3(&Usb); // This will just create the instance
  9.  
  10. #include <Servo.h>
  11. Servo s1;
  12.  
  13. int p1 = 100;
  14. int p2 = 5;
  15.  
  16. void setup() {
  17.   pinMode(MAX_GPX, INPUT);
  18.   pinMode(MAX_RESET, OUTPUT);
  19.   digitalWrite(MAX_RESET, LOW);
  20.   delay(20);
  21.   digitalWrite(MAX_RESET, HIGH);
  22.  
  23.   Serial.begin(115200);
  24.   if (Usb.Init() == -1) {
  25.     Serial.print(F("\r\nOSC did not start"));
  26.     while(1);
  27.   }
  28.   s1.attach(7); //To cholerstwo powoduje problem
  29.   Serial.print(F("\r\nPS3 Bluetooth Library Started"));
  30. }
  31.  
  32. void loop() {
  33.   Usb.Task();
  34.  
  35.   if (PS3.PS3Connected){
  36.    
  37.     s1.write(85);
  38.    
  39.     if (PS3.getButtonClick(TRIANGLE)) {
  40.       s1.write(p1);
  41.       Serial.print(F("\r\nTriangle"));
  42.     }
  43.      
  44.     if (PS3.getButtonClick(CIRCLE)) {
  45.       s1.write(p2);
  46.       Serial.print(F("\r\nCircle"));
  47.     }
  48.   }
  49.    
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement