Jump to content

DigitalOut with Python


Bayu A

Recommended Posts

this is my project. Controlling multiplexer. like this for script. 

const mux = ["0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"];
const Yarray = [];
const Parray = [];

for (i = 0; i<16; i++){    
    //MUX bagian 1 - Vccs
    StaticIO.Channel0.DIO3.value = mux[i].substr(3,1);
    StaticIO.Channel0.DIO2.value = mux[i].substr(2,1);
    StaticIO.Channel0.DIO1.value = mux[i].substr(1,1);
    StaticIO.Channel0.DIO0.value = mux[i].substr(0,1);
    
    //MUX bagian 2 - Ground
    var a = i+1;
    if (a>15){
        a -= 16
    }
    StaticIO.Channel0.DIO7.value = mux[a].substr(3,1);
    StaticIO.Channel0.DIO6.value = mux[a].substr(2,1);
    StaticIO.Channel0.DIO5.value = mux[a].substr(1,1);
    StaticIO.Channel0.DIO4.value = mux[a].substr(0,1);
    
    wait (0.1);

    for (j=0; j<16; j++){
        //Bagian 3 - (-)
        StaticIO.Channel1.DIO15.value = mux[j].substr(3,1);
        StaticIO.Channel1.DIO14.value = mux[j].substr(2,1);
        StaticIO.Channel1.DIO13.value = mux[j].substr(1,1);
        StaticIO.Channel1.DIO12.value = mux[j].substr(0,1);
        
        //Bagian 4 - (+)
        b = j+1;
        if (b>15){
            b-=16;
        }
        StaticIO.Channel1.DIO11.value = mux[b].substr(3,1);
        StaticIO.Channel1.DIO10.value = mux[b].substr(2,1);
        StaticIO.Channel1.DIO9.value = mux[b].substr(1,1);
        StaticIO.Channel1.DIO8.value = mux[b].substr(0,1);

        print("i: "+i+" ,a: "+a+" ,j: "+j+" ,b:"+b);

        wait(0.3);

I want to uses python code. How? 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...