online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> using namespace std; typedef uint8_t byte; const long interval = 1000; static long currentMillis; char plussignpoint = 0; //To determine where is the + in +CCLK in the char array char serialdata[256] = ""; //Array to store the chars before parsing int rdpos = 0; int pointingfinger = 0; char timeen = 0; byte stat0 = 0; char futstat0 = 0; char searchcharpos = 0; char enabled = 1; char searchchartype = 0; char smsvalid = 0; class _Serial1 { std::string buffer{"$OK\r\n"}; public: int available() { return (int)buffer.size(); } char read() { char c = buffer[0]; buffer.erase(0, 1); return c; } } Serial1; void loop() { if (enabled == 1) { if (stat0 == 0) { if (Serial1.available () > 0) { serialdata[pointingfinger] = Serial1.read(); serialdata[pointingfinger+1] = 0; if (serialdata[pointingfinger] == '+') { searchcharpos = pointingfinger; searchchartype = 1; futstat0 = 1; } else if (serialdata[pointingfinger] == '$') { if (smsvalid == 1) { // == searchcharpos = pointingfinger; searchchartype = 2; futstat0 = 2; } if (smsvalid == 0) { // == stat0 = futstat0; pointingfinger = 0; return; } } else if (serialdata[pointingfinger] == '\n') { stat0 = futstat0; pointingfinger = 0; enabled = 0; return; } else if (serialdata[pointingfinger] == '\r') { stat0 = futstat0; pointingfinger = 0; enabled = 0; return; } else { stat0 = 0; pointingfinger = 0; return; } pointingfinger++; } if (pointingfinger == 255) { pointingfinger = 0; enabled = 0; } } } } int main() { for (int i=0; i<10; i++) { loop(); cout << "enabled: " << (int)enabled << " stat0: " << (int)stat0 << " funttat0: " << (int)futstat0 << " pfinger: " << (int)pointingfinger << " searchcharpos: " << (int)searchcharpos << " searchchartype: " << (int)searchchartype << " serialdata:" << serialdata << endl; } return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue