Skip to main content
1 of 2

Lets assume that electrically everything is good and maybe your scope's ground was poorly connected. Can you try this as a test and see if it gives you the result you want ( I don't have an Arduino to test):

const int pinBuzzer = A5; // the number of pin for the buzzer unsigned long T = 0; // "T" value //max input size expected for a single incoming msg #define INPUT_SIZE 32 char serialCommandstr[INPUT_SIZE + 1]; byte serialCommandindex = 0; //index of RX buffer for itterating void setup() { delay(500); Serial.begin(115200); } // END Setup() void loop() { Serial.println("Waiting for input in the form of \"<XY>\""); Serial.println("X=[A/B], Y=[1~8]"); serialGetCommand(); if (serialCommandstr[1] == 'A') { T = (serialCommandstr[2] - 1) - char('0'); Serial.print("A, "); } Serial.print("T="); Serial.print(T); Serial.print("us..."); //Beep to indicate waveform start tone(pinBuzzer, 1319, 50); delay(51); } void serialGetCommand() { char serialCommand_singleChar = '\0'; serialCommandindex = 0; while(serialCommand_singleChar != '>') { if(Serial.available()) { serialCommand_singleChar = Serial.read(); serialCommandstr[serialCommandindex++] = serialCommand_singleChar; } } serialCommandstr[serialCommandindex] = '\0'; } ```