0
I declared a variable char SendDataCmd[256]
which will store the commands sent from the computer to the microcontroller via UART
. Commands have different sizes as for example RST, ADV ON e SET SNAME=BC118
among others.
I have a function that will send the commands, follows below.
#include "bc118.h"
#include "usart.h"
#include "main.h"
char SendDataCmd[256];
int BC118_Init()
{
SendDataCmd[] = "RST";//Linha que não funciona
HAL_UART_Transmit(&huart1, &SendDataCmd, 1, 100);
SendDataCmd[] = "ADV ON";//Linha que não funciona
HAL_UART_Transmit(&huart1, &SendDataCmd, 1, 100);
}
I’m having trouble storing commands inside SendDataCmd
since they have different size than the declared vector, how could you store them correctly within this vector?
Want to copy the text into the
SendDataCmd
? If this is the case the function you are looking for isstrcpy
– Isac