Changeset f5452ab in pyramid
- Timestamp:
- 10/16/13 22:02:27 (7 years ago)
- Branches:
- master
- Children:
- 5d7bb94
- Parents:
- dbfae54
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/Puzzlebox_Pyramid/Puzzlebox_Pyramid.ino
rdbfae54 rf5452ab 769 769 checkSum=(16-checkSum) & B1111;// 16-sum is the formula of this helicopter 770 770 771 mainCode= (mainCode << 5) | (checkSum << 1); // get the last 4 digit of CheckSum771 mainCode= (mainCode << 5) | (checkSum << 1); // get the last 4 digit of CheckSum 772 772 773 773 bitWrite(mainCode,0,1); // finish code … … 1076 1076 void updateFrameADK() { 1077 1077 1078 // update RGB_Panel[][] here to set next Frame you want to send 1079 // For Example: 1080 // RGB_Panel[0][0]=0; 1081 // RGB_Panel[0][1]=0; 1082 // RGB_Panel[0][2]=255; 1083 // will update the LED on 1 o'clock position to be blue. 1084 1085 // This following code simulates when you wear a headset. 1086 // RGB_Panel[5][0]=0; 1087 // RGB_Panel[5][1]=255; 1088 // RGB_Panel[5][2]=0; 1089 1090 // int attention=random(0,7); //generates 0~6 1091 // int meditation=random(0,7); 1092 1078 Serial.print("updateFrameADK(): "); 1079 Serial.print("eegSignal: "); 1080 Serial.print(eegSignal, DEC); 1081 Serial.print(" | eegAttention: "); 1082 Serial.print(eegAttention, DEC); 1083 Serial.print(" | eegMeditation: "); 1084 Serial.println(eegMeditation, DEC); 1085 1086 1087 setColorWheel(0, 0, 0); // black 1088 1089 1090 // if the signal is good enough, light 6:00 LED in green. 1091 if (eegSignal == 100) { 1092 RGB_Panel[5][0]=0; 1093 RGB_Panel[5][1]=255; 1094 RGB_Panel[5][2]=0; 1095 } else { 1096 setColorWheel(255, 0, 0); // red 1097 // RGB_Panel[5][0]=0; 1098 // RGB_Panel[5][1]=0; 1099 // RGB_Panel[5][2]=0; 1100 return; 1101 } 1093 1102 1094 1103 int attention = calculateMeter(eegAttention); … … 1096 1105 1097 1106 1098 for(int i=6; i<=6+attention; i++){ 1107 // for(int i=6; i<=6+attention; i++){ 1108 // RGB_Panel[i][0]=255; 1109 // RGB_Panel[i][1]=0; 1110 // RGB_Panel[i][2]=0; 1111 // } 1112 // 1113 // if (meditation==6){ 1114 // RGB_Panel[11][0]=0; 1115 // RGB_Panel[11][1]=0; 1116 // RGB_Panel[11][2]=255; 1117 // } 1118 // 1119 // for(int i=4; i>=4-meditation; i--){ 1120 // RGB_Panel[i][0]=0; 1121 // RGB_Panel[i][1]=0; 1122 // RGB_Panel[i][2]=255; 1123 // } 1124 // 1125 // if (attention==6) 1126 // RGB_Panel[11][0]=255; 1127 // 1128 // for(int i=6+attention; i<=11; i++){ 1129 // RGB_Panel[i][0]=0; 1130 // RGB_Panel[i][1]=0; 1131 // RGB_Panel[i][2]=0; 1132 // } 1133 // 1134 // for(int i=4-meditation; i>=0; i--){ 1135 // RGB_Panel[i][0]=0; 1136 // RGB_Panel[i][1]=0; 1137 // RGB_Panel[i][2]=0; 1138 // } 1139 1140 1141 //light up & dim red LED according to attention level 1142 for(int i=6; i<6+attention; i++) { 1099 1143 RGB_Panel[i][0]=255; 1100 1144 RGB_Panel[i][1]=0; 1101 1145 RGB_Panel[i][2]=0; 1102 1146 } 1103 1104 if (meditation==6){ 1105 RGB_Panel[11][0]=0;1106 RGB_Panel[11][1]=0;1107 RGB_Panel[11][2]=255; 1108 } 1109 1110 for(int i=4; i> =4-meditation; i--){1147 // for(int i=6+attention; i<11; i++) { 1148 // RGB_Panel[i][0]=0; 1149 // RGB_Panel[i][1]=0; 1150 // RGB_Panel[i][2]=0; 1151 // } 1152 1153 //light up & dim blue LED according to meditation level 1154 for(int i=4; i>4-meditation; i--) { 1111 1155 RGB_Panel[i][0]=0; 1112 1156 RGB_Panel[i][1]=0; 1113 1157 RGB_Panel[i][2]=255; 1114 1158 } 1115 1116 if (attention==6) 1117 RGB_Panel[11][0]=255; 1118 1119 for(int i=6+attention; i<=11; i++){ 1120 RGB_Panel[i][0]=0; 1121 RGB_Panel[i][1]=0; 1122 RGB_Panel[i][2]=0; 1123 } 1124 1125 for(int i=4-meditation; i>=0; i--){ 1126 RGB_Panel[i][0]=0; 1127 RGB_Panel[i][1]=0; 1128 RGB_Panel[i][2]=0; 1129 } 1130 1131 1132 } // updateFrame 1159 // for(int i=4-meditation; i>-1; i--) { 1160 // RGB_Panel[i][0]=0; 1161 // RGB_Panel[i][1]=0; 1162 // RGB_Panel[i][2]=0; 1163 // } 1164 1165 1166 } // updateFrameADK() 1133 1167 1134 1168 … … 1143 1177 sendCode(formCode(_throttle,_yaw,_pitch)); 1144 1178 delay(80); // originally 36, 51, 66, 80 1145 } // setOrbitThrottle 1179 1180 } // setOrbitThrottle() 1146 1181 1147 1182 … … 1158 1193 if (! modeADK) { 1159 1194 modeADK = true; 1195 modeBluetooth = false; 1196 modeSerial = false; 1160 1197 Serial1.end(); 1161 1198 Serial.println("INFO: parseADK connection detected, setting modeADK"); … … 1167 1204 if (len > 0) { 1168 1205 1169 setColorWheel(255,255,255); // White1206 // setColorWheel(255,255,255); // White 1170 1207 1171 1208 if (msg[0] == 0x1) { … … 1288 1325 } 1289 1326 1290 setColorWheel(255,0,0); // Red1327 // setColorWheel(255,0,0); // Red 1291 1328 1292 1329 } // len … … 1303 1340 1304 1341 1305 1306 1307 1308 1309 1310
Note: See TracChangeset
for help on using the changeset viewer.