Changeset 85e090e in pyramid
- Timestamp:
- 10/15/13 19:32:58 (7 years ago)
- Branches:
- master
- Children:
- b62ab59
- Parents:
- 5202e8d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/Puzzlebox_Pyramid/Puzzlebox_Pyramid.ino
r5202e8d r85e090e 28 28 Original Author: Hao Zhang <hz@puzzlebox.info> 29 29 30 Last Modified 2013-10-1 030 Last Modified 2013-10-15 31 31 by Steve Castellotti <sc@puzzlebox.info> 32 32 … … 58 58 59 59 // Global variables for controlling Orbit helicopter 60 int _throttle_hover=85; 61 60 62 // variables start with "_" means global variable 61 63 char _throttle=0; //32~127, default 0 … … 196 198 delay(500); 197 199 198 //setupBlueToothConnection();200 setupBlueToothConnection(); 199 201 200 202 //wait 1s and flush the serial buffer … … 253 255 // to land. 254 256 255 _throttle= 85;257 _throttle=_throttle_hover; 256 258 257 259 … … 728 730 } 729 731 732 730 733 } // updateFrame 731 734 … … 757 760 758 761 void sendCode(long code) { 762 763 // Serial.println("sendCode(formCode(", _throttle, ",", _yaw, ",", _pitch, "));"); 764 sendCode(formCode(_throttle,_yaw,_pitch)); 765 759 766 char n; 760 767 //starting code, with special time period. … … 1052 1059 switch (_command) { 1053 1060 1054 case 'P': _throttle= 85; Serial.print("_throttle="); Serial.println(int(_throttle)); break;1061 case 'P': _throttle=_throttle_hover; Serial.print("_throttle="); Serial.println(int(_throttle)); break; 1055 1062 case 'O': _throttle=0; Serial.print("_throttle="); Serial.println(int(_throttle)); break; 1056 1063 case 'U': _throttle+=1; Serial.print("_throttle="); Serial.println(int(_throttle)); break; … … 1078 1085 // ################################################################ 1079 1086 1087 void setOrbitThrottle(int throttle) { 1088 1089 setColorWheel(255,255,0); // Yellow 1090 1091 _throttle=throttle; 1092 setThrottle(); 1093 sendCode(formCode(_throttle,_yaw,_pitch)); 1094 delay(80); // originally 36, 51, 66, 80 1095 } // setOrbitThrottle 1096 1097 1098 // ################################################################ 1099 1080 1100 void parseADK() { 1081 1101 … … 1094 1114 1095 1115 if (len > 0) { 1116 1117 setColorWheel(255,255,255); // White 1118 1096 1119 if (msg[0] == 0x1) { 1097 1120 // Reserved … … 1183 1206 } 1184 1207 } 1185 1186 1208 1209 1187 1210 // updateFrame(eegAttention, eegMeditation, eegSignal); 1188 1211 updateFrameADK(); 1189 sendFrame(1000); 1190 1212 1213 1214 // Orbit Throttle 1215 if (msg[0] == 0x7) { 1216 1217 Serial.println(" (msg[0] == 0x7) "); 1218 1219 int throttle = 0; 1220 1221 if (msg[1] == 0x1) { 1222 throttle = _throttle_hover; 1223 Serial.println(" (msg[1] == 0x1) "); 1224 } 1225 else if (msg[1] == 0x0) 1226 Serial.println(" (msg[1] == 0x0) "); 1227 1228 setOrbitThrottle(throttle); 1229 1230 } else { 1231 1232 // sendFrame(1000); 1233 sendFrame(0); 1234 sendCode(formCode(_throttle,_yaw,_pitch)); 1235 delay(80); //cycle(); 1236 } 1237 1238 setColorWheel(255,0,0); // Red 1191 1239 1192 1240 } // len 1193 1241 else { 1194 1242 // setColorWheel(255, 0, 0); // red 1195 delay( 10); //cycle();1243 delay(80); //cycle(); 1196 1244 } 1197 1245 } // if acc.isConnected() … … 1230 1278 1231 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291
Note: See TracChangeset
for help on using the changeset viewer.