% Count in binary % Dec2bin converts to a binary string (not numbers), and the argument 3 means % we need at least 3 chars back (for input 1 we want '001', not '1'). clear; delete(daqfind); % clear everything out DIO = digitalio('nidaq', 'Dev3'); % always use these parameters as they are DOlines = addline(DIO, 0:2, 'out'); % create 3 output lines for Value = 0:7 putvalue(DOlines,Value); fprintf('Showing %d in lights as %c %c %c.\n',Value, dec2bin(Value,3)); % amazing to me that the above statement works... the scanner is looking for % the three c(haracters) in the single string from dec2bin. Yikes. pause(1); end Value = 0; disp('Over to you:'); while 0 <= Value & Value <= 7 fprintf('Showing %d in lights as %c %c %c.\n', Value, dec2bin(Value,3)); putvalue(DOlines,Value); Value = floor(input('enter a number from 0 to 7, or outside range to quit: ')); end putvalue(DOlines, [0 0 0]); % turn out the lights delete(daqfind); % clear everything out