Dependents:
              
        
    
    
        
            
                
            
            hello
        
    
        
            
                
            
            SerialTestv11
        
    
        
            
                
            
            SerialTestv12
        
    
        
            
                
            
            Sierpinski
        
    
    
        
            
                
                    ... more
                
            
        
    
    
5 comments:
    
    
    
    
        
            
            
                
                    
                       not working (one aout is at 0V, no matter what the corresponding ain has):
 
int main() {
    AnalogOut aout1(PA_5);
    AnalogIn ain1(PC_0);
    AnalogOut aout2(PA_6);
    AnalogIn ain2(PA_7);
    while(1) {
        aout1=ain1;
        aout2=ain2;
        wait_ms(1); 
    }
}
working (with artefacts):
 
int main() {
    while(1) {
        AnalogOut aout1(PA_5);
        AnalogIn ain1(PC_0);
        aout1=ain1;
        AnalogOut aout2(PA_6);
        AnalogIn ain2(PA_7);
        aout2=ain2;
        wait_ms(1); 
    }
}
 
                
             
         
     
 
    
    
    
    
        
            
            
                
                    
                       You need <<code>> and <</code>> around your code (on seperate lines) to have it readable. Best place to have it noticed is on the mbed github though: https://github.com/mbedmicro/mbed
                    
                 
                
             
         
     
 
    
    
    
    
        
            
            
                
                    
                       Did you try taking the definitions out of the While loop?
Keep the while loop empty with only the "wait_ms(1)" inside.
                    
                 
                
             
         
     
 
    
    
    
    
        
            
            
                
                    
                       Also I suggest you use the read/write APIs
Meaning
aout1.write_u16(ain1.read_u16());
instead of just using the equal operators.
Let me know how that works for you!
                    
                 
                
             
         
     
 
    
    
    
    
        
            
            
                
                    
                       Hi Mustafa,
when placing the definitions out of the while loop it only works, if I comment out one of the ain/aout combinations, e.g.:
 
int main() {
    // Combination 1
    AnalogOut aout1(PA_5);
    AnalogIn ain1(PC_0);
    // Combination 2
//    AnalogOut aout2(PA_6);
//    AnalogIn ain2(PC_1);
    while(1) {
        aout1.write_u16(ain1.read_u16());
//        aout2.write_u16(ain2.read_u16());
        wait_ms(1); 
    }
}
As soon as both are uncommented, I get 0V on PA_5, no matter what is on PC_0, but PC_1 -> PA_6 is still working.
                    
                 
                
             
         
     
 
     
    
not working (one aout is at 0V, no matter what the corresponding ain has):
int main() { AnalogOut aout1(PA_5); AnalogIn ain1(PC_0); AnalogOut aout2(PA_6); AnalogIn ain2(PA_7); while(1) { aout1=ain1; aout2=ain2; wait_ms(1); } }working (with artefacts):
int main() { while(1) { AnalogOut aout1(PA_5); AnalogIn ain1(PC_0); aout1=ain1; AnalogOut aout2(PA_6); AnalogIn ain2(PA_7); aout2=ain2; wait_ms(1); } }