Ignore:
Timestamp:
11/29/12 08:17:10 (8 years ago)
Author:
AzureViolin <zhanghaotz@…>
Branches:
master, RawEEG, Raw_EEG_Plot, Servo, Tab_Interface, pyramid
Children:
0401409, 655a816
Parents:
3322dad
Message:

flyOrbit.m can now generate arbitry control code for play from laptop. update read.me

File:
1 edited

Legend:

Unmodified
Added
Removed
  • octave/GenerateAudioCommand/flyCommand.m

    r3322dad ra0b523e  
    1212elseif code=='demo2' 
    1313        code=[1 1 1 1 1 1 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 1 1 1 0 0 0 0];%maximum throttle 
    14 endif 
    1514 
    16 if (AndroidOriOS=='iOS') 
     15elseif code=='demo3' 
     16        code=[0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 0];%minimum throttle 
     17elseif code=='demo4' 
     18        code=[1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 ];%test for Untitled 04 
     19        endif 
     20 
     21if (length(AndroidOriOS)==3)%'iOS' 
    1722longHIGH=875;longHIGH_s=floor(longHIGH*sps/1e6)+1;%longHIGH[us] longHIGH_s[sample] 
    1823longLOW=729;longLOW_s=floor(longLOW*sps/1e6); 
     
    4146%fullCodeWave=[fullCodeWave zeros(sizeof(fullCodeWave))]; 
    4247 
    43 elseif AndroidOrioS=='Android' 
     48elseif length(AndroidOriOS)==7 %'Android' 
     49 
     50longHIGH=875;longHIGH_s=floor(longHIGH*sps/1e6)-4;%longHIGH[us]  longHIGH_s[sample] 
     51longLOW=729;longLOW_s=floor(longLOW*sps/1e6+3); 
     52shortHIGH=458;shortHIGH_s=floor(shortHIGH*sps/1e6)-2; 
     53shortLOW=333;shortLOW_s=floor(shortLOW*sps/1e6)+1; 
     54 
     55codeWave=[halfSineGenDirect('d',longLOW_s-1,0,1,sps);halfSineGenDirect('u',longHIGH_s-2,0,1,sps);             halfSineGenDirect('d',shortLOW_s-1,0,1,sps);halfSineGenDirect('u',longHIGH_s-2,0,1,sps); halfSineGenDirect('d',shortLOW_s,0,1,sps);0]; %starting 5 half period 
     56 
     57% notice that the "code" here should be a 28 bit binary array. 
     58m=0; 
     59n=0; 
     60for i=1:size(code,2) 
     61codeWave = [codeWave; bitGenDirect(code(i),1,sps,longHIGH_s,   longLOW_s,shortHIGH_s,shortLOW_s)]; 
     62if code(i)==1 
     63        n=n+1; 
     64elseif code(i)==0 
     65        m=m+1; 
     66endif 
     67 
     68if n==115  
     69        n=0; 
     70        codeWave=[codeWave;0]; 
     71endif 
     72if m==101 
     73        m=0; 
     74        codeWave=[codeWave;0]; 
     75endif 
     76         
     77endfor 
     78 
     79codeWave=[codeWave; halfSineGenDirect('u',longHIGH_s,0,1,sps)];  %last half period 
     80 
     81if(flipOrNot=='flip') 
     82    codeWave=-codeWave; 
     83endif 
     84 
     85fullCodeWave=[]; 
     86for i=1:repeatTime 
     87            fullCodeWave=[fullCodeWave; codeWave; zeros(space,1)]; 
     88endfor 
     89 
     90 
    4491endif %if AndroidOriOS=='iOS' 
    4592 
Note: See TracChangeset for help on using the changeset viewer.