help me plz /Can't use u16,u8 #561
-
https://github.com/j2devtribe/arduinolib-modbusrtu-slave/tree/master/ModbusRTUSlave I'm trying to use this library, but there's an error saying that u16 and u8 are not declared, so how do I solve it? I used a translator because I am a non-English speaker. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Just add
after the
line to define them. Whether this will allow the library to actually work, I have no idea. The fact they use those variables makes me think that this library is for an old 8-bit AVR and may include hardware-specific code. Good luck! |
Beta Was this translation helpful? Give feedback.
-
Thank you for your help first I only add your add code in Arduino.h It is nice work. but I can't explain the code to people who don't know to add code. so, I added your code in Modbus_rtu.h. It was fine in Pico, but an error occurred in Arduino Mega. Through that error, I learned the different code. In Arduino Mega typedef unsigned char u8; The above code was added to Modbus_rtu.h and worked well with Mega and Pico. Thank you |
Beta Was this translation helpful? Give feedback.
Just add
after the
line to define them.
Whether this will allow the library to actually work, I have no idea. The fact they use those variables makes me think that this library is for an old 8-bit AVR and may include hardware-specific code.
Good luck!