Class Projet 1

Hello;
I'm trying to solve the problem here:
Realize a system measuring an ultrasonic distance, and taking into account the temperature for the ultrasonic propagation speed (other assumptions: altitude 0 and dry air). Distance and temperature will be displayed on the serial monitor.
Attention: for more precision you will take two temperature sensors and you will do their average. If you detect a problem in the sensors (more than 0.5 ° C difference), switch on a red LED.
Material: HC-SR04 + TMP36 + 74HC151 + Arduino

To solve the problem, I propose the following algorithm:

int Value1; 
int Value2;
int S0=1;
int S1=2;
double temps;//Or time
double distance;//Distance
double vitesse=0.034;//Speed

void setup()
{
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
digitalWrite(S1,LOW);
digitalWrite(S0, LOW);
pinMode(7, OUTPUT);
 digitalWrite(7, LOW);
 Serial.begin(9600);
  pinMode(2, OUTPUT);


}
void loop()
{
digitalWrite(S1,LOW);
digitalWrite(S0, LOW);
pinMode(7, OUTPUT); 
digitalWrite(7, HIGH);
delay(15);
digitalWrite(7, LOW);
digitalWrite(S0, HIGH);
digitalWrite(S1,LOW);
Serial.print("Capteur");
pinMode(7, INPUT);
temps=pulseIn(7, INPUT);
distance=(float)((vitesse*temps)/);
Serial.println("La distance est:")//The distance is 
Serial.print(distance);
digitalWrite(7, LOW);
digitalWrite(S0, LOW);
digitalWrite(S1,HIGH);
pinMode(7, INPUT); 
Value1=analogRead(7);
digitalWrite(S1,HIGH);
digitalWrite(S0,HIGH);
 pinMode(7, INPUT);
  Value2=analogRead(7);
  Serial.println("Premier capteur");
  Serial.print(Value1);
  Serial.println("Second capteur");
   Serial.print(Value2);
   if ( abs( Value1- Value2)<0.5)// Connected to led for blinking it 
   {
     pinMode(2, OUTPUT);
     digitalWrite(2,HIGH); 
     
   }

Can you tell me if it's okay please?

Can you tell me if it's okay please?

No, it isnt, but the compiler already told you that.

Also, pulseIn returns an unsigned long, not a float.

(How is it that this is project 1 in English, but project 2 in French?)

To answer your question I posted on the English and French forum. To have answers more quickly.
In addition I initialize the function PulseIn with signature "double" with the variable "time".

To answer your question I posted on the English and French forum.

So, which topic do you want me to delete?

In addition I initialize the function PulseIn with signature "double" with the variable "time".

No.

Can you give the answer . Because i'm Noobie .

I already did give you an answer, in my first reply.

Now, which topic do you want me to delete?

Delete All in french please .
Can you help me for my " Class projet 2" too?
Then how modificate "Class Projet 1" 's algorithm ?

int S0=1;
...
pinMode(S0, OUTPUT);
...
 Serial.begin(9600);

Do you see the problem here?

No
Explain to me please..

Look carefully at your Arduino.
Look what it says next to pin 1.

I just saw that the pin 1 does not correspond to what I ask him to do. I would choose another. Pin 2, for example. Apart from that, do you think that the program will work ?

Code that does not compile cannot work.

Hum...what kind of maths is this? distance=(float)((vitesse*temps)/);

What is connected to pin 7?

...
temps=pulseIn(7, INPUT);
...
Value1=analogRead(7);
...
Value2=analogRead(7);

Don’t mess with pins 0 and 1 if you use the Serial (the USB cable communication with your computer goes in there)

J-M-L:
What is connected to pin 7?

...

temps=pulseIn(7, INPUT);
...
Value1=analogRead(7);
...
Value2=analogRead(7);

Analogue pin seven (assuming this is not a Uno) is a different pin to digital pin seven.

I use a Arduino Uno . And i saw on the Website that , i can use "analogRead" even the port isn't analog .
Or it's false ?

And i saw on the Website that , i can use "analogRead" even the port isn't analog .
Or it's false ?

That is not true. analogRead() ONLY operates on analog pins. digitalRead() will work on the analog pins, though, since the analog pins are also digital pins.

PaulS:
That is not true. analogRead() ONLY operates on analog pins. digitalRead() will work on the some* analog pins, though, since the some* analog pins are also digital pins.

*On products where the A6 and A7 pins are present, these are analogue-only inputs.

AWOL:
Analogue pin seven (assuming this is not a Uno) is a different pin to digital pin seven.

Yes - but probing / wanted to double check as I suspected uno being used and OP not making the difference.