Feeds:
Posts
Comments

Archive for January, 2007

Well, at this moment I am doing a small project, writing a GUI for Mitsubishi MoveMasterEx-1, robot arm. It is quite old but still good enough for lab practice or for learning. I am now writing some code for the GUI. The GUI itself will talk to a microcontroller, and I am using AVR ATMega16. The controller then will send signal to the driver then to the DC motor. The DC Motor will return encoder pulse to the circuit. I will need to find the value of the degree rotation . Actually, I haven’t gone that far :D.

Mitsubishi MoveMasterEx-1

FYI, I am new in VC++, that’s why I would like to share several small functions but important. Here we go:

Converting int to CString or LPCTSTR:

CString CMOVEMASTERDlg::IntToString(int Nilai)
{

//refer to MSDN: ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vccrt/html/eb746581-bff3-48b5-a973-bfc0a4478ecf.htm

char charBuffer[65];

CString temp;

if ( _itoa_s(Nilai, charBuffer, 65, 10) != 0) //if conversion goes wrong
{
AfxMessageBox(_T(“Error converting int to LPCTSTR or CString”), MB_ICONERROR | MB_OK);
::MessageBeep(MB_ICONEXCLAMATION);
}

temp = charBuffer;

return temp;

}

Though this function is really simple, but if you have read the UNICODE things, or wide character sometimes as a newbie you will get confused 😛

Auto Scrolling in CEdit Class:

//The Scroll to the last line
this->LineScroll (GetLineCount(), 0);

For automatic scrolling, you need to add this line on your code after you add/insert string in the CEdit control.

Readonly Text Edit (CEdit Class):

m_EditOutput.SetBackColor(RGB(255,255,255));
m_EditOutput.SetTextColor(RGB(0,0,0));

The secret for any Text Edit control with the same background and text color is that you set the background and textcolor manuall. Add these 2 lines on your code (on the OnInitDialog())

Guess, If there’s any new things I learned, I will share in this blog 🙂

Advertisements

Read Full Post »

This was our work in 2005 in firefighting robot contest 2005 @trial2:

One day, we shall build like this one:

Wish us luck :p

Read Full Post »