NardJ
February 27, 2021, 10:31am
1
I need a Serial Monitor with more features than the standard Serial Monitor in the Arduino IDE. For personal use I made one which can:
send and display messages in ascii, hex, decimal format or auto detect
also show messages you sent in the message log
display ascii, hex and dec representations of all message in the log (on click)
auto search and connect to serial device on start and auto reconnect if connection was interrupted
store often send messages as convenient buttons to click and send again
use a script to automate sending messages depending on received messages.
To see how these features could be implemented see GitHub - NardJ/SerialMonitorPP: A better Arduino Serial Monitor, with a scripting engine to automate send/receive sequences
Below 2 screenshots.
Would be real nice if these features can be implemented in the arduino IDE. (Would save me time maintaining and developing )
I know this is old, OLD school and is dating myself terribly but it would be nice if the serial monitor also supported escape sequences to position and manipulate the cursor.
I'm thinking the near-universal VT100/VT52 ANSI escape sequences.
For example, this code on an Uno:
#define ESC 0x1B //27 escape character
uint32_t
timePrint;
char
szStr[20];
//show some analog channels and GPIO inputs
const uint8_t grADCs[4] = { A0, A1, A2, A3 };
const uint8_t grGPIs[4] = { 2, 3, 4, 5 };
void setup()
{
Serial.begin( 115200 );
while( !Serial );
consoleClearScreen();
consoleSetCursorVis(false);
for( uint8_t i=0; i<4; i++ )
{
consoleSetCursorPosition( 2, 3+i );
//ADC Channel 1:
Serial.print( "ADC Channel " ); Serial.print( i ); Serial.print( ":" );
}//for
for( uint8_t i=0; i<4; i++ )
{
pinMode( grGPIs[i], INPUT_PULLUP );
consoleSetCursorPosition( 40, 3+i );
//GPIO Pin x:
Serial.print( "GPIO Pin " ); Serial.print( 2+i ); Serial.print( ":" );
}//for
}//setup
void loop()
{
static uint8_t
ADCIndex=0;
uint32_t timeNow = millis();
if( timeNow - timePrint >= 10ul )
{
timePrint = timeNow;
//update the analog channel values
consoleSetCursorPosition( 17, 3+ADCIndex );
sprintf( szStr, "%4d", analogRead( grADCs[ADCIndex] ) );
Serial.print( szStr );
//update the digital I/O channels
consoleSetCursorPosition( 52, 3+ADCIndex );
Serial.print( digitalRead( grGPIs[ADCIndex] ) ? "HI":"LO" );
//bump the channel index
ADCIndex++;
if( ADCIndex == 4 )
ADCIndex = 0;
//after changing ADC channel, dummy read for sample/hold cct
analogRead( grADCs[ADCIndex] );
}//if
}//loop
//VT100/VT52 ANSI Escape Sequences
void consoleClearScreen( void )
{
Serial.write( ESC );
Serial.print( "[2J" );
}//consoleClearScreen
void consoleClearLineFromCursor( void )
{
Serial.write( ESC );
Serial.print( "[0K" );
}//consoleClearLineFromCursor
void consoleSetCursorVis( bool vis )
{
char
szTemp[10];
sprintf( szTemp, "[?25%c", vis==true ? 'h':'l' );
Serial.write( ESC );
Serial.print( szTemp );
}//consoleSetCursorVis
void consoleSetCursorPosition( uint8_t x, uint8_t y )
{
char
szTemp[10];
sprintf( szTemp, "[%d;%dH", y, x );
Serial.write( ESC );
Serial.print( szTemp );
}//consoleSetCursorPosition
shows this in a Putty terminal:
For reference, the VT100 sequences can be found at http://ascii-table.com/ansi-escape-sequences-vt-100.php
It'd be nice if the IDE's serial monitor could do this instead of having to invoke a 3rd-party terminal program like Putty.
system
Closed
July 8, 2021, 3:19pm
3
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.