CodeBlocks Arduino IDE - real C++ IDE for Arduino development (rev.20130827)

So glad to see it works for you.

Great project, but how can i add a custom library ?

In Arduino Ide, i put the files to "E:\Eigene Dateien\Arduino\libraries" and i can work with it.

How does this work in codeblocks?

Andree

Of course.
Simply place the library files in the sketch folder and add the .cpp file into the project (choose menu Project->Add Files).

Thanks, but did not work.

Windows-XP.
Starting codeblocks, create new arduino project "test".
Copy folder "RTClib" to folder "C:\arduino\test".
Add "RTClib\RTClib.h" + "RTClib\RTClib.cpp" to project.
edit "scetch.ino"
#include <Wire.h>
#include "RTClib.h"

compile....
C:\arduino\test\RTClib\RTClib.cpp|4|fatal error: Wire.h: No such file or directory|

RTClib.cpp 4: #include <Wire.h>

I bet you have not changed build target from "Simulator" to an actual arduino board type. You also need to enable compile and link option for Wire library (right click the Wire.cpp in libraries sub-folder in project view).

You are right, now Build target "Mega260" , sorry about that.

sketch.ino|3|error: RTClib.h: No such file or directory.

Ok, set up a search path to RTClib - directory under build options.

its working now.

Thanks a lot.

Andree

Hi, I'd like to know if somehow we can use the simulator to mock digitalRead/analogRead/interupt signals?

stanleyhuang:
CodeBlocks Arduino IDE is a complete out-of-box C++ IDE for Arduino development most suitable for software engineers demanding a more powerful IDE and those who need to heavily modify or develop Arduino libraries. I have been maintaining the project basically to provide myself a productive and flexible Arduino development environment. Now I mainly release for Windows only, while someone else has forked my code on github and maintain the linux port.

Actually you can hack into the core files under ardusim directory (forked from arduino core files) to do whatever you want when arduino APIs are called.

tianshuo:
Hi, I'd like to know if somehow we can use the simulator to mock digitalRead/analogRead/interupt signals?

I will include "." in search path by default.

Andree:
You are right, now Build target "Mega260" , sorry about that.

sketch.ino|3|error: RTClib.h: No such file or directory.

Ok, set up a search path to RTClib - directory under build options.

its working now.

Thanks a lot.

Andree

I see them alright, but I'm not sure where should I start from. I guess maybe the simulator could listen to a port for signals?
Could someone give an example using wiring_analog.c?

stanleyhuang:
Actually you can hack into the core files under ardusim directory (forked from arduino core files) to do whatever you want when arduino APIs are called.

tianshuo:
Hi, I'd like to know if somehow we can use the simulator to mock digitalRead/analogRead/interupt signals?

Actully my long-term goal is to implement a simulator which acts like a http server and use HTML to render the simulation.
About hacking into arduino core files, taking digitalWrite as an example, I just added one line at the end like this:

void digitalWrite(uint8_t pin, uint8_t val)
{
	uint8_t timer = digitalPinToTimer(pin);
	uint8_t bit = digitalPinToBitMask(pin);
	uint8_t port = digitalPinToPort(pin);
	volatile uint8_t *out;

	if (port == NOT_A_PIN) return;

	// If the pin that support PWM output, we need to turn it off
	// before doing a digital write.
	if (timer != NOT_ON_TIMER) turnOffPWM(timer);

	out = portOutputRegister(port);

	uint8_t oldSREG = SREG;
	cli();

	if (val == LOW) {
		*out &= ~bit;
	} else {
		*out |= bit;
	}

	SREG = oldSREG;

#ifdef ARDUSIM
    fprintf(stderr, "[MCU] Pin %d state changed to %s\n", pin, val ? "HIGH" : "LOW");
#endif
}

tianshuo:
I see them alright, but I'm not sure where should I start from. I guess maybe the simulator could listen to a port for signals?
Could someone give an example using wiring_analog.c?

Project path is added as include file search path by default in latest release.

Andree:
You are right, now Build target "Mega260" , sorry about that.

sketch.ino|3|error: RTClib.h: No such file or directory.

Ok, set up a search path to RTClib - directory under build options.

its working now.

Hello Everyone,

Not sure what I'm missing... installed the latest version 20130322 on Win7 x64 but I can't get the "Build target" to show anything. From all the reading and searching I've done, it seems like this needs to show the board I'm working with. I have an Arduino UNO connected and can use it using Arduino IDE. I'm very excited to get this working - very nice IDE, thank you Stanley for the Arduino integration.

Ahe Arduino Builder works (Tools > Arduino Builder), it can access the board.

Can somebody help me out or point me to documents/discussion regarding the setup?

Thank you,
Max

You need to start a Arduino project in the IDE before you can have anything in the build target list.
I will publish a tutorial for beginners soon.

Maximus2013:
Not sure what I'm missing... installed the latest version 20130322 on Win7 x64 but I can't get the "Build target" to show anything. From all the reading and searching I've done, it seems like this needs to show the board I'm working with. I have an Arduino UNO connected and can use it using Arduino IDE. I'm very excited to get this working - very nice IDE, thank you Stanley for the Arduino integration

That worked!
Thank you!!!

I work now with CodeBlocks Arduino IDE for a few days - it's a pleasure.
I want to say..

Thank you, thanks for this great project.

Andree

It's always a great pleasure to see my work being useful to others.

Stanley -

Thanks so much for your efforts on this project. While the initial codeblock learning curve took a little getting used to, I find it so much easier to navigate through code, and to SEE how my variables and functions relate to each other.

One question though - in your future releases, would it be possible to include a a couple more of the "Additional" Plugins? Reading through the Codeblocks forum and Wiki, plugins have to be added at installation, and can't be added after the fact. I don't know exactly how you assemble the arduino package, but if possible, I'd really like to see the Library finder (yes I have used add files recursively) and Code Snippets plugins added.

Thanks Again
Paul G.

Actually I specially removed many plugins from original codeblocks in order to provide Arduino users a clean and simple environment. You can re-add your needed plugin simply by copying the plugin file (install dir\share\codeblocks\plugins) from original codeblocks installation. I think I will add the two plugins you mentioned in the future release.

Hello ,

first of all great work!! I just found this today and I'm looking forward to work with CodeBlocks instead of the native Arduino IDE.

One thing I noticed when testing a Arduino project with the Project builder. It sets up a Blink sketch. It compiles and when run, it shows the results in the Sim window. Great so far. However, when I use the stop button, the Sim window dissaprears but the compile and run buttons stay greyed out. With the task manager I found that the program is still executing and I need to kill the process with the Win Task manager.

If however I close the Sim window directly, everything works. So it looks like the stop button has a problem.

I'm using •Revision 20130329

Woud be great of you could fix this in one of the next releases.

Thanks,
Peter