Selected for you
 
Articles Hierarchy
 
Online C compiler and debugger - how to speed up the development of your C code
I'm sure that you encountered with the situation when your code or part of your code didn't work as you wanted - operation with a few pointers, logic operations, conditions, parsing of value from long array etc.

If you have modern microcontrollers and development board which supports debugger (e.g. STM32 and Nucleo, Discovery) you can easily step (debug) your code in debugger.
If you don't have debugger, how do you follow values, variables? Are you using UART? Or LCD?

The change of code, compilation, comparison of results, and upload the code takes a much time.
If there is some tools which you help you with development of code faster, you should use that.

I have the best experience with Online C compiler/debugger called OnlineGDB.
Of course, it's not necesary to use "Online", you can download Eclipse or other IDE and debug the code there. But, I prefer this OnlineGDB compiler/debugger.

OnlineGDB



The compiler/debugger contains "Run" button. This button runs whole code.
The "Debug" button contains debugging of your code.
The debug can be stopped by "Stop" button.
If you want to share the code to your friends, you can use the "Share" button. You can also save the code by "Save" button.

The Online compiler/debugger OnlineGDB is used only for C, without controling of the peripherals.
So, the OnlineGDB detects a mistake in your code but it can't control GPIO, I2C and another.
As I mentioned, that's amazing tool when you have to detect the mistake in your code where you are using parsing of array, pointers, logical operators and conditions.

Btw, the OnlineGDB supports more programming languages like C++, Java, Python, PHP ....

Here is easy example of using:



We have a few variables and we calculate some result.
Click to "Run" for running of your code.
The whole code is run and you see the result in "Input" window.

So, if the behavior of your code is not the same as you expect you can write "printf" behind of each lines and check if the variables have expected value or not.
If you have Arduino, I guess that you will use UART.
Or you use debugger.

Debugger is tool which shows you values in variables, registers during the running of microcontroller.
So you can step the code, it means that you stop on every line of code - "Step over". If there is function on the line and you want to go on function, you use "Step into" button.
The next opinion is using the breakpoints. That are point where you label the line where the code has to be stopped.



As I mentioned, you can't copy-paste whole code e.g. from Arduino to this OnlineGDB. That's not possible to control GPIOs, interfaces or other.
But you can easily debug your part of code where you want to parse of array, use logical operations, conditions and so on.
Home webpage of project: https://www.onlinegdb.com/

How to use debugger in OnlineGDB.

Disqus