![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Final code for our 4180 Drawing Robot!
Dependencies: 4DGL-uLCD-SE gCodeParser mbed
VStudio2013_Sources/listCOM.cpp
- Committer:
- jford38
- Date:
- 2014-04-30
- Revision:
- 2:ba15545a4ccf
File content as of revision 2:ba15545a4ccf:
#include "stdafx.h" #include "listCOM.h" #include "string.h" #using <System.dll> using namespace System; using namespace System::IO::Ports; using namespace System::ComponentModel; _TCHAR my_port[NAME_SIZE]; _TCHAR* listCOM() { wcscpy(my_port, L"\\\\.\\"); _TCHAR temp[10]; array<String^>^ serialPorts = nullptr; try { // Get a list of serial port names. serialPorts = SerialPort::GetPortNames(); } catch (Win32Exception^ ex) { Console::WriteLine(ex->Message); } Console::WriteLine("The following serial ports were found:"); // Display each port name to the console. for each(String^ port in serialPorts) { Console::WriteLine(port); _snwprintf(temp, NAME_SIZE, L"%hs", port); wcscat_s(my_port, NAME_SIZE, temp); } return my_port; }