I can only get two deep callback to work here is my function

function send(Callback) { 
    var Angle = document.getElementById("DampAngle").value;
    var AtCmd6 = 0x4 ;
    var AtCmd4 = 0x4 ;
    var AtCmd3 = 0x4 ;
    var AtCmd2 = 0x4 ;

    if ((Angle & 0x8) == 0x8) { // ANGL[3:0] = [D6, D4, D2, D1]        
        atCmd6 = "0x05";}//   
    else {
        atCmd6 = "0x04";}//   

    if ((Angle & 0x4) == 0x4) { // ANGL[3:0] = [D6, D4, D2, D1]
        atCmd4 = "0x05";}//   
    else { 
        atCmd4 = "0x04";}//   
            
    if ((Angle & 0x2) == 0x2) { // ANGL[3:0] = [D6, D4, D2, D1]
        atCmd3 = "0x05";}//   
    else {
        atCmd3 = "0x04";}//   
                
    if ((Angle & 0x1) == 0x1) { // ANGL[3:0] = [D6, D4, D2, D1]
        atCmd2 = "0x05";}//   
    else {
        atCmd2 = "0x04";}//   
   
    sendCmd(damp1Addr, "D6", atCmd6, 
        sendCmd(damp1Addr, "D4", atCmd4, 
            sendCmd(damp1Addr, "D3", atCmd3,  
                sendCmd(damp1Addr, "D2", atCmd2))))

    function Callback() {sendCmd(damp1Addr, "AC", 0 );} //apply changes
  

}

It will only perform two of the sendCmd commands no matter how I structure 
it.   I want to do these function in this order but the next function can 
not start until the last one is completed.  

sendCmd(damp1Addr, "D6", atCmd6);
sendCmd(damp1Addr, "D4", atCmd4); 
sendCmd(damp1Addr, "D3", atCmd3); 
sendCmd(damp1Addr, "D2", atCmd2)
sendCmd(damp1Addr, "AC", 0 );

every time I call the send function.   

I went through a few tutorials and looked at many examples and although I 
think I understand what callback is doing I do not understand how to 
construct the code to do more than just two callbacks.   

Can anyone help?

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to