コード例 #1
0
ファイル: Outputs.cpp プロジェクト: jimyu15/Jim-DCC
void Output::parse(char *c){
  int n,s,m,a;
  Output *t;
  
  switch(sscanf(c,"%d %d %d %d",&n,&s,&m,&a)){
    
    case 2:                     // argument is string with id number of output followed by zero (LOW) or one (HIGH)
      t=get(n);
      if(t!=NULL)
        t->activate(s);
      else
        INTERFACE.print("<X>");
      break;

    case 3:                     // argument is string with id number of output followed by a pin number and invert flag
      create(n,s,m,1);
    break;

    case 4:
      servo(n, m, a);
    break;

    case 1:                     // argument is a string with id number only
      remove(n);
    break;
    
    case -1:                    // no arguments
      show(1);                  // verbose show
    break;
  }
}