简体   繁体   中英

Im new with arduino and I made this function

it does this error: invalid conversion from 'char' to 'const char*' [-fpermissive] how do I fix this? enter image description here

First of all Arduino uses C++ language, The reason for the error: " invalid conversion from 'char' to 'const char*' " is that the function Serial.readStringUntill() returns a , but you are trying to equate it with a character in myList=='A' (anything encased in ' is considered character in C++), you can fix the error by accessing first character from the 'myList' and then equate like shown below,但是你正在尝试用 aUn Serial 返回字符串。 myList=='A'中的字符(包含在'中的任何内容都被视为 C++ 中的字符),您可以通过访问 'myList' 中的第一个字符来修复错误,然后等同于如下所示

myList[0]=='A'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM