A Cheap Serial Based TTL Device: Difference between revisions
Jump to navigation
Jump to search
Crodriguez (talk | contribs) No edit summary |
Crodriguez (talk | contribs) No edit summary |
||
Line 24: | Line 24: | ||
To Send a pulse: | To Send a pulse: | ||
TTLpin = 2; % any pin from 2 through 19 can be used | TTLpin = 2; % any pin from 2 through 19 can be used | ||
DIO.digitalWrite(TTLpin,1); % set pin to 5V wrt to GND | DIO.digitalWrite(TTLpin,1); % set pin to 5V wrt to GND | ||
DIO.digitalWrite(TTLpin,0); % set pin to 0V wrt to GND | DIO.digitalWrite(TTLpin,0); % set pin to 0V wrt to GND | ||
To close the session | To close the session: | ||
delete DIO; | |||
delete DIO; |
Revision as of 20:26, 27 February 2013
Hardware/Parts:
Software/Downloads:
To Initialize the Arduino Box:
if (exist('DIO', 'var') == 0) % the exact address can be figured out using http://arduino.cc/en/Main/Software DIO = arduino('/dev/tty.usbmodem621'); end for i = 2:19 % filp all pins to a low state (0V) DIO.pinMode(i,'output'); DIO.digitalWrite(i,0); end
To Send a pulse:
TTLpin = 2; % any pin from 2 through 19 can be used DIO.digitalWrite(TTLpin,1); % set pin to 5V wrt to GND DIO.digitalWrite(TTLpin,0); % set pin to 0V wrt to GND
To close the session:
delete DIO;