Changeset 30bc659 in orbit
- Timestamp:
- 11/15/12 10:09:04 (10 years ago)
- Branches:
- master, RawEEG, Raw_EEG_Plot, Servo, Tab_Interface, pyramid
- Children:
- 08d64cc
- Parents:
- f0fb814
- Files:
-
- 9 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arduino/puzzlebox_orbit_Uno_V3/puzzlebox_orbit_Uno_V3.ino
rf0fb814 r30bc659 20 20 21 21 //variables start with "_" means global variable 22 char _throttle= 87; //32~12723 char _pitch=31; //0~63 24 char _yaw=78; //16~127 22 char _throttle=0; //32~127, default 0 23 char _pitch=31; //0~63, default 31 24 char _yaw=78; //16~127, default 78 25 25 char _channel='A'; 26 26 char _command; … … 84 84 checkSum=(16-checkSum) & B1111;//16-sum is the formula of this helicopter 85 85 86 mainCode= (mainCode << 5) | (checkSum << 1); //get the last 4 digit of CheckSum , use XOR (^) to flip bits86 mainCode= (mainCode << 5) | (checkSum << 1); //get the last 4 digit of CheckSum 87 87 88 88 bitWrite(mainCode,0,1); //finish code … … 113 113 _command = Serial.read(); 114 114 switch (_command) 115 { 116 case 'U': _throttle+=5; Serial.print("_throttle="); Serial.println(int(_throttle)); break; 117 case 'D': _throttle-=5; Serial.print("_throttle="); Serial.println(int(_throttle)); break; 118 case 'L': _yaw+=5; Serial.print("_yaw="); Serial.println(int(_yaw)); break; 119 case 'R': _yaw-=5; Serial.print("_yaw="); Serial.println(int(_yaw)); break; 115 { 116 case 'P': _throttle=85; Serial.print("_throttle="); Serial.println(int(_throttle)); break; 117 case 'O': _throttle=0; Serial.print("_throttle="); Serial.println(int(_throttle)); break; 118 case 'U': _throttle+=1; Serial.print("_throttle="); Serial.println(int(_throttle)); break; 119 case 'D': _throttle-=1; Serial.print("_throttle="); Serial.println(int(_throttle)); break; 120 case 'L': _yaw+=15; Serial.print("_yaw="); Serial.println(int(_yaw)); break; 121 case 'R': _yaw-=15; Serial.print("_yaw="); Serial.println(int(_yaw)); break; 120 122 case 'F': _pitch+=5; Serial.print("_pitch="); Serial.println(int(_pitch)); break; 121 123 case 'B': _pitch-=5; Serial.print("_pitch="); Serial.println(int(_pitch)); break; 122 case '1': _channel='A'; Serial.print ("_channel=A"); break;123 case '2': _channel='B'; Serial.print ("_throttle=B"); break;124 case '3': _channel='C'; Serial.print ("_throttle=C"); break;124 case '1': _channel='A'; Serial.println("_channel=A"); break; 125 case '2': _channel='B'; Serial.println("_channel=B"); break; 126 case '3': _channel='C'; Serial.println("_channel=C"); break; 125 127 } 126 128 }
Note: See TracChangeset
for help on using the changeset viewer.