[아두이노] arduino에서 char to int

Skills/Programming 2016. 2. 16. 20:22

arduino를 쓰면서 atoi를 쓰고 있었는데.. 뭔가 형  변환이 잘 안되는 느낌이었다.

그래서 열심히 구글링을 하다보니..

char array 끝에 '\0' 가 있어야 했다..

 

* Ref 

[1] http://forum.arduino.cc/index.php?topic=103511.0

 

 

설정

트랙백

댓글

serial communication에서 inturrupt를 사용하는 이유

Skills/Programming 2016. 2. 15. 14:56

openCM 9.04의 예를 들어보자. 


openCM의 처리기에서는 loop() 구문의 내용이 계속 돌고 있다.

이 속에서 serial communication의 데이터를 처리하면 그 사이에 들어오는 데이터를 받지 못하는 경우가 발생한다. 

따라서 interrupt 구문 안에서 데이터를 처리해야 하며, interrupt 구문은 최대한 간결하게 짜는 것이 좋겠다. 

설정

트랙백

댓글

[안드로이드] 디바이스를 못찾을 때..

Skills/Programming 2016. 2. 6. 15:52

사용하는 기기의 드라이버를 적절하게 설치했는지를 확인하자.

본인의 경우 S사의 갤럭*노*2를 사용했는데 아래의 드라이버를 설치해서 문제를 해결할 수 있었다.


http://local.sec.samsung.com/comLocal/support/down/kies_main.do?kind=usb

설정

트랙백

댓글

드롭박스(dropbox) 가입과 동시에 용량 늘리기

Skills/Computer 2016. 1. 20. 10:44

https://db.tt/cACdiNEr


아직 드롭박스에 가입하지 않으신 분은 위의 주소로 가입하시고 설치 후 로그인하시면

가입하신 분과 저에게 500MB 보너스 용량이 지급된다고 합니다. 

보너스 용량은 컴퓨터 1대 당 한 번만 준다고 하니 주의하시고요..




설정

트랙백

댓글

MFC에서 소켓통신이 잘 안될 때.. [유니코드 멀티바이트]

Skills/Programming 2016. 1. 14. 18:35

기존에 VS2010에서 잘 실행되던 프로그램이 VS2013으로 migration을 한 후에 소켓 통신이 정상적으로 이루어지지 않는 현상이 발생했다.

결론부터 이야기하자면, 아래 속성의 그림에서 볼 수 있듯 vs2013부터 MFC에서는 유니코드를 쓰기를 원한다고(?)한다(이 부분은 확실치 않지만, 멀티바이트를 사용하기 위해서는 따로 추가 설치를 해야 한다.). 



결국 문제의 원인은 inet_addr() 함수가 char* 형 변수를 받아야 하는데, VS2013부터는 MFC에서 char* 형 변수가뜻대로 동작하지 않을 때가 많다. 

따라서 유니코드 프로그램을 작성하면 inet_addr()함수를 쓰기 귀찮아진다.

해결책 중에 하나는 inet_addr이 유니코드를 인자로 받도록 만드는 것이다. (아래의 소스 참조)

DWORD _tinet_addr(const TCHAR *cp)
{
    #ifdef UNICODE
    char IP[16];
    int Ret = 0;
    Ret = WideCharToMultiByte(CP_ACP, 0, cp, _tcslen(cp), IP, 15, NULL, NULL);
    IP[Ret] = 0;
return inet_addr(IP);
#endif
#ifndef UNICODE
return init_addr(cp);
#endif
}

본인의 프로그램 역시 network 라이브러리 부분에 위 함수를 추가하여 사용하고 있다.

* Ref



설정

트랙백

댓글

Aten cs1782 kvm switch 사용기

Skills/Computer 2015. 8. 31. 11:15

우선 처음에 어려웠던 부분은, mouse와 keyboard를 인식시키는 부분이었다. 

특히, 마우스가 인식이 되는 듯 하지만 위아래로만 동작할 때가 있다.

(KVM스위치는 원하는 포트에 mouse와 keyboard를 연결해줘야 제대로 동작한다.)

Numlock 버튼과 - 버튼을 이용한 Hotkey setting mode에 들어가서

mouse 포트를 reset해 주었다. 


그리고 듀얼 모니터를 구성하고자 했는데, 모니터 하나가 화면이 나오지 않았다.

이 때에도 역시 HSM 모드에서 D 버튼을 눌러주니 제대로 동작했다!! 

자세한 내용은 매뉴얼을 참조하면 매우 좋다!!



* Ref

[1] Aten CS1782A manual,  file:///C:/Users/user/Downloads/cs1782a-1784a-s_2013-12-09.pdf


cs1782a-1784a-s_2013-12-09.pdf




설정

트랙백

댓글

MS Word에서 두 문서 비교하기 (버전 비교)

Skills 2015. 8. 10. 13:20

가끔 문서 작업을 하다보면, 자주 수정하게 되어 버전 관리를 한다거나 혹은 여러 명이 수정을 거치게 되는 경우가 있다. 

그 때 유용한 기능이 있음.

MS Word의 리본메뉴 중 검토 메뉴의 하위 메뉴 중에서 아래 붉게 네모친 곳을 보면 "비교" 라는 것을 볼 수 있다. 


이것을 눌러보면 아래 그림처럼 두 문서의 변경 내역을 한 눈에 검토할 수 있다. (엄청나게 편리하다!!)

사용 방법은 "비교" 버튼을 눌러보면 너무나 쉽게 알 수 있기 때문에 생략하기로 한다.



설정

트랙백

댓글

ROS 사용기 - Eclipse 설치하고 desktop launch 설정하기

Research 2015. 7. 23. 17:29

In Ubuntu 14.04 LTS !

1. Install Java

$ sudo apt-get install openjdk-7-jre


2. Download Eclipse according to your system


3. Extract the file & move it to /opt/


4. create a new desktop file

$ sudo gedit /usr/share/applications/eclipse.desktop

 *copy following lines*

[Desktop Entry]

Name=Eclipse 

Type=Application

Exec=env UBUNTU_MENUPROXY= /opt/eclipse/eclipse 

Terminal=false

Icon=/opt/eclipse/icon.xpm

Comment=Integrated Development Environment

NoDisplay=false

Categories=Development;IDE;

Name[en]=eclipse.desktop


5. Additional Tasks


Run the following command to automatically install it in Unity

$ sudo desktop-file-install /usr/share/applications/eclipse.desktop


– Create a symlink in /usr/local/bin

$ cd /usr/local/bin/

$ sudo ln -s /opt/eclipse/eclipse


– For Eclipse icon to be displayed in dash, run following command

$ sudo cp /opt/eclipse/icon.xpm /usr/share/pixmaps/eclipse.xpm



* Ref

[1] http://sysads.co.uk/2014/04/install-latest-eclipse-ide-ubuntu-14-04-13-10/


설정

트랙백

댓글

ROS 사용기 - rosbag으로는 teaching data를 playback할 수 없다.

Research 2015. 7. 22. 18:06

The limitations of rosbag record/play

In the previous section you may have noted that the turtle's path may not have exactly mapped to the original keyboard input - the rough shape should have been the same, but the turtle may not have exactly tracked the same path. The reason for this is that the path tracked by turtlesim is very sensitive to small changes in timing in the system, and rosbag is limited in its ability to exactly duplicate the behavior of a running system in terms of when messages are recorded and processed by rosrecord, and when messages are produced and processed when using rosplay. For nodes like turtlesim, where minor timing changes in when command messages are processed can subtly alter behavior, the user should not expect perfectly mimicked behavior.


* Ref

[1] http://wiki.ros.org/ROS/Tutorials/Recording%20and%20playing%20back%20data

설정

트랙백

댓글

ROS 사용기 - (4) ROS Industrial Tutorial

Research 2015. 7. 17. 23:56

ROS Industrial tutorial을 진행하다 보니 catkin_make의 주요 기능을 반드시 사용할 필요가 있었다.

튜토리얼 진행 중에 robotiq 패키지를 github로부터 clone시켜왔는데, 이녀석이 catkin_make를 할 때 빌드 실패 메시지를 띄우는 바람에 원하는 패키지의 빌드가 되지 않는 것이다!!

그래서 원하는 패키지만 빌드하는 방법을 알 필요가 있었는데..

바로 catkin_make -DCATKIN_WHITELIST_PACKAGES="000"  기능이다.

여기에서 000 에는 빌드하고자 하는 package의 이름을 적으면 되겠다.


물론 catkin_make는 catkin workspace의 root 폴더에서 실행해야 한다는 사실도 잊으면 안된다!



설정

트랙백

댓글