Arduino : String to Int-방법은 다음과 같습니다
Arduino를 프로그래밍 할 때 때때로 문자열을 정수로 변환해야합니다. 이 실용적인 팁 에서이 작업을 수행하는 방법을 찾을 수 있습니다
Arduino : 문자열을 Int로
Arduino에서 문자열을 정수로 변환하려면 먼저»String a = "23"«과 같은 명령을 사용하여 새 문자열을 정의해야합니다.
- 이 문자열을 정수로 변환하려면 정수 변수가 필요합니다. 올바른 값을 자동으로 할당 할 수도 있습니다.
- »int b = atoi (a);«명령으로이를 수행 할 수 있습니다. 변수 "b"는 이제 값 23을 정수로 갖습니다.
- 그러나 문자열에 공백이나 문자가 포함되어 있지 않은지 확인하십시오.
다음 실용적인 팁에서는 Arduino로 전압계를 작성하는 방법을 보여줍니다.