I have some couple of minor problems, I just don’t know how to solve them.
(Objectif 1: Use a RES variable in math equation )
On first image of Arduino, I can’t figure out how to put “,2” character to get two decimals on Serial monitor.

(Objectif 2: Test measurement on D2 using boolean)
On second image, I can’t understand an error in my void setup

Thanks a lot. Sorry for french comments.

Screen shot 2012-11-19 at 6.13.43 AM.png

First, posting pictures of your code is nowhere near as good as posting your real code. We can't cut and paste mistakes from your pictures.

Also, once we go to reply mode, the pictures go away.

I can't figure out how to put ",2" character to get two decimals on Serial monitor.

It goes INSIDE the parentheses. It's an optional argument. It's also the default. Of course, it only applies to printing floats or doubles (which are really floats, too). Printing an int to two decimal places makes no sense.

On second image, I can't understand an error in my void setup

Your code is full of errors. Some time spent with the reference page would be much more beneficial than my pointing them all out.

There are several problems.

The ',2' arguments you're trying to pass to Serial.print need to be inside the brackets, as PaulS pointed out.

In your case the numbers you're printing are integers (whole numbers) so for example 5/2 is equal to 2.5 but when you use integer arithmetic the '.5' is lost and the answer is 2. If you're printing integers then the second argument isn't required anyway.

In your print statements you are printing values like this:

Serial.print(RES = RES/2);

That has two effects: it prints the value of RES/2, and it also assigned that value back to RES so RES is no longer equal to five - this would affect the results of all the subsequent calculations. If you only want to print the value of RES/2 without changing the value of RES in the process, then you can do it like this:


I'm sorry to say this, but you really don't have much of a clue, do you? I think there are more incorrect lines that there are correct ones.

You need to go back to absolute basics. Before you do ANY programming, you need to understand the BASIC SYNTAX of the language.

You should read and thoroughly understand this PDF file:

It details the basic syntax of the C language, and once you know that, you will quickly see where all your errors are.

Sorry for french comments.,33.0.html

Ok! I think I got it finally, I have just to mention float to initiate my variables and then I can select number of decimals.

Thanks a lot for tutorials!!