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?
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
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.
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.
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.
getting a bit deeper into it but now I'm stuck at an issue I'm sure it's some compiler (preprocessor) setting I'm missing. If I compile/build below code (I've added a function 'test' at the end of the code), it gives me the error message:
error: 'test' was not declared in this scope
Hmmm.... if I put the function above 'void setup()', so in the delcaration section, it works fine. Well, most of my code has functions at the end and I thought compilers could recognize this. Is there some settings I can change?
Here is the code which is producing the error. It's the example which comes up if I generate a Project for Arduino. I only added that function 'test'
thanks
Peter
#include <Arduino.h>
/*
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
int x;
void setup()
{
Serial.begin(9600);
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
Serial.println("Hello world!");
}
void loop()
{
delay(1000); // wait for a second
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
test(x);
}
void test(int i) {
//do stuff
}
Well, most of my code has functions at the end and I thought compilers could recognize this.
No they don't, you cannot use a variable or a function before it's been defined. The Arduino IDE protects you from this by scanning the code and including the definitions at the top of the file somewhere.
It seems that this environment doesn't do that for you.
You have to either move the functions or provide the definitions like so.
#include <Arduino.h>
/*
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
int x;
void test(int i); <============== test defined before being used
void setup()
{
Serial.begin(9600);
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
Serial.println("Hello world!");
}
void loop()
{
delay(1000); // wait for a second
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
test(x);
}
void test(int i) {
//do stuff
}
This may seem like a pain but it's standard practice probably everywhere but in the Arduino IDE.
is it possible to run an Arduino sketch in C:B and route the output to Processing? I know how to do this when code runs on a real Arduino connected via USB. This would be great because I finally could test all my stuff on my Laptop before uploading it to Arduino.
If this is possible, any chance that some one could post a simple sketch and the matching Processing code?
Solution: Well, I'm sure there are multiple ways of doing this, if there is a better one, please let me know. I realized that there are off corse no physical devices connected to the USB ports as both tools (C:B and Processing) run on the same PC, yet they shall exchange data. So, I did install a COM port emulator called "Virtual Serial Port Driver". The settings I had to make where intuitive with an easy GUI. I set up COM1 and COM2 with an virtual Cross over cable between.
Now, in my processing sketch I open COM1 like this:
myPort = new Serial(this, Serial.list()[0], 115200); --- where "(0)" = COM1, "[1]" = would be COM2 and so on...
In my Arduino sketch in C:B I open COM2 like this:
Serial.begin(115200,2);
Thats it, running both sketches, they now can exchange data.
Looks good and seems to run well. Not sure how to single step or see the variable values except by doing a Serial.print. Any chance of being able to look at two outputs at the same time such as LCD and Serial.
Also, we have just released v0.98D of Simulator for Arduino on our new website here
Simulator can do single step as the code is just compiled into native program, regardless in the very limitated implementation of simulation of arduino APIs. Currently the only things can be simluated is serial output and digital pins output.
What do you mean by being able to look at two outputs?
Virtronics:
Looks good and seems to run well. Not sure how to single step or see the variable values except by doing a Serial.print. Any chance of being able to look at two outputs at the same time such as LCD and Serial.
I guess this should have nothing to do with the type of IDE. Any sketch can be compiled and uploaded via Arduino IDE can be done the same way (maybe some slight mod is needed) in CodeBlocks.
nav2go:
Hello There,
is it possible to run an Arduino sketch in C:B and route the output to Processing? I know how to do this when code runs on a real Arduino connected via USB. This would be great because I finally could test all my stuff on my Laptop before uploading it to Arduino.
Correct. As this is a real C++ IDE, it requires the code to comply with the rules of C++. Arduino IDE automatically scan the code and generate the function declaration at the beginning of the code while I haven't yet implemented this. Anyway, I think it's always a good habit to declare a function before using or write the function before calling code.
Graynomad:
Well, most of my code has functions at the end and I thought compilers could recognize this.
No they don't, you cannot use a variable or a function before it's been defined. The Arduino IDE protects you from this by scanning the code and including the definitions at the top of the file somewhere.
It seems that this environment doesn't do that for you.
You have to either move the functions or provide the definitions like so.