Arduino Serial Monitor给出了我的输出的问号和框
我正在编写一个程序来加密给定的输入并将密码文本发送到Lora Wave上,但我似乎被困在此步骤中。 我正在使用Heltec Lora ESP32,并包括用于AES函数的MBEDTLS库。
#include "mbedtls/aes.h"
#include "heltec.h"
#include <SPI.h>
#define BAND 433E6 //setting the LoRa bands to 433 mhz
mbedtls_aes_context aes;
int counter = 0;
unsigned char key[32] = "key"; // 256 bit - AES = 32 bytes for key
unsigned char iv[16];
unsigned char input [128] = "given AES plain text";
unsigned char output[128];
size_t input_len = 40;
size_t output_len = 0;
void setup() {
Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.Heltec.Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
//setup code to enable LoRa
Serial.begin(115200); //establishing serial communication with esp32 and pc
mbedtls_aes_setkey_enc( &aes, key, 256 );
mbedtls_aes_crypt_cbc( &aes, MBEDTLS_AES_ENCRYPT, 48, iv, input, output ); // AES function from mbedtls library,
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
Serial.println((char*)output); //here is the issue
// send packet
LoRa.beginPacket();
LoRa.print((char*)output);
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(5000);
}
输出给出一个包含(IM假设)特殊字符的密码文本,当我查看Arduino串行显示器时,它显示了带有正常字符的一堆反向问号和框。
Serial.println((char*)output);
是否有可以在Arduino IDE中显示这些特殊字符的打印方法?
I am writing a program to encrypt the given input and send the cipher text over LoRa waves, but I seem to be stuck in this step.
I am using a Heltec LoRa ESP32 and have included the mbedtls library for the AES functions.
#include "mbedtls/aes.h"
#include "heltec.h"
#include <SPI.h>
#define BAND 433E6 //setting the LoRa bands to 433 mhz
mbedtls_aes_context aes;
int counter = 0;
unsigned char key[32] = "key"; // 256 bit - AES = 32 bytes for key
unsigned char iv[16];
unsigned char input [128] = "given AES plain text";
unsigned char output[128];
size_t input_len = 40;
size_t output_len = 0;
void setup() {
Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.Heltec.Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
//setup code to enable LoRa
Serial.begin(115200); //establishing serial communication with esp32 and pc
mbedtls_aes_setkey_enc( &aes, key, 256 );
mbedtls_aes_crypt_cbc( &aes, MBEDTLS_AES_ENCRYPT, 48, iv, input, output ); // AES function from mbedtls library,
}
void loop() {
Serial.print("Sending packet: ");
Serial.println(counter);
Serial.println((char*)output); //here is the issue
// send packet
LoRa.beginPacket();
LoRa.print((char*)output);
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(5000);
}
the output gives a cipher text containing (Im assuming) special characters and when I look at the Arduino serial monitor it shows bunch of reverse question marks and boxes with normal characters.
Serial.println((char*)output);
Is there a print method that can show these special characters in the Arduino IDE?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
串行Montority Baud的价值应与上述价值相同。

The value of serial monitory baud should be same as above value.
