I have a very mysterious problem, I can’t get a Serial output in a for loop.
See test code below.
#include <Arduino.h>
uint16_t values[] = {1000, 1005, 1300};
uint8_t splitValues[6] = {0, 1, 2, 3, 4, 5};
void setup()
{
Serial.begin(115200);
delay(100);
Serial.println("Hello");
// unsigned short MyShort;
// unsigned char Char1; // lower byte
// unsigned char Char2; // upper byte
// Split short into two char
uint8_t j = 0;
Serial.print("J ");
Serial.println(j);
for (uint8_t i = 0; i++; i < 3)
{
Serial.print("I ");
Serial.println(i);
Serial.print("J ");
Serial.println(j);
// splitValues[j] = values[i] & 0xFF;
Serial.print("spliVaues J");
Serial.println(splitValues[j]);
// splitValues[j + 1] = values[i] >> 8;
Serial.print("spliVaues J+1 ");
Serial.println(splitValues[j + 1]);
j++;
}
for (uint8_t i = 0; i++; i < 6)
{
Serial.print("spliVaues I ");
// Serial.print(splitValues[i]);
}
Serial.print("\r\n");
// Serial.print("")
// Char1 = MyShort & 0xFF;
// Char2 = MyShort >> 8;
// merge two char into short
// MyShort = (Char2 << 8) | Char1;
}
void loop()
{
}
platformio.ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
monitor_speed = 115200
Monitor Output
--- Terminal on /dev/cu.usbserial-0001 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
'��0078000,len:13192
load:0x40080400,len:3028
entry 0x400805e4
Hello
J 0
no output from inside the loop
Thanks for any help or hint
Rainer