Need to connect my usb

Hello, have a project for my studies with a arduino portenta h7 machin control but i need to write in my usb the data. Have 3 captors connected on my arduino and i need to write the data all the minutes.If you have the idea for help thanks

And i'm sorry for my england i'm not english

There is a French language section of this forum if it would be easier for you to communicate in your native language

Would you like this topic moved to that section ?

I have post in French language but the french people redirect me on this forum

There is no problem with you posting here other than there may be problems on both sides in understanding one another. For instance, what you call "3 captors" are possibly what I would call sensors, but are they ?

Google translate seems to do quite a good job if that helps

Yes i have 3 sensors, but i want to write results of my sensors in a text on my USB

What sensors are they and what have you tried so far ?

I have tried a USB port programme for another arduino and i have 1 FC-28 for humidity and 2 temperature sensor

Your requirements sound quite simple

Start with a single sensor, read its value and print it to the Serial monitor

Please try that and post your code here. If it does not work then tell us what it does or does not do

int i = 1;

void setup() {
  Serial.begin(9600);
}

void loop() {
  float sensor = analog_in.read(0);
  float humidity = ( sensor * 3,3 *1000 / 65535 / 0,28 - 1079 ) / 25.68; //transform in %
  SumH += humidite_mes;
  delay(1000);
   
   if (i == 60) {
  SumH = SumH / 60;
  }
    Serial.print("Humidity: ");
    Serial.print(SumH, 2);
    Serial.println("%");
}

I presume that does not compile

The obvious reason is that analog_in is not declared in the sketch. Where did you get the sketch from ?

The sketch is a parts of my final programm and my final programm is fine

So you can read a sensor and output the value it returns to the Serial port. In that case I am not sure where you are stuck

You mention "all the minutes" in your original post. Do you mean that you want to read the values and output them every minute, or do you mean something else ?

Infact I want to read my values ​​every second make an average over the minutes then write it in a text document which is on my USB key

Here is an example of that timing

void setup()
{
  Serial.begin(115200);
  pinMode(inPin, INPUT);
}

void loop()
{
  unsigned long currentTime = millis();
  static unsigned long secondStart = currentTime;
  static unsigned long minuteStart = currentTime;
  unsigned long oneSecond = 1000;
  unsigned long oneMinute = oneSecond * 60UL;
  if (currentTime - secondStart >= oneSecond)
  {
    Serial.println("one second");
    secondStart = currentTime;
  }
  if (currentTime - minuteStart >= oneMinute)
  {
    Serial.println("\tone minute");
    minuteStart = currentTime;
  }
}

Where the example prints "one second" you need to read the sensors and add each one to a total

Where the example prints "one minute" you need to calculate the averages, write them to SD and reset the totals to zero

Thx for your example but i have a program for that my problem is i need to write in the txt into the USB key

What exactly do you mean by "USB key" ?

Why not write the data to an SD card connected directly to the Arduino, then you can read it with whatever device (PC, tablet, 'phone, etc) that you want

yes i want write the data but the arduino portenta H7 machine control don't have a SD Port but a USB port

So add an SD card breakout board to it

Why i can't write data on USB ?

And a adapator USB to SD or a SD module ?

If you are printing to the Serial monitor then you are already writing to the USB port of the board

I know little or nothing about the Arduino Portenta H7 but I very much doubt that it can write directly to a USB device plugged into the PC if that is what you want to do. Is that what you want to do ?

If so then using a terminal emulator program on the PC, such as CoolTerm you can capture the data received on a serial port and write it to a file. The file could be on a USB memory stick if that is what you want