alex0sunny

main.cpp usbrndis

Jul 16th, 2025
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <Arduino.h>
  2. #include <STM32Ethernet.h>
  3.  
  4. void setup() {
  5.   Serial.begin(115200);  // UART через ST-Link для логов
  6.   while (!Serial);
  7.  
  8.   Serial.println("Starting Ethernet over USB RNDIS...");
  9.  
  10.   Ethernet.begin();
  11.  
  12.   while (!Ethernet.linkStatus()) {
  13.     Serial.println("Waiting for Ethernet link...");
  14.     delay(500);
  15.   }
  16.  
  17.   Serial.print("IP address: ");
  18.   Serial.println(Ethernet.localIP());
  19. }
  20.  
  21. void loop() {
  22.   static uint32_t timer = 0;
  23.   if (millis() - timer > 1000) {
  24.     Serial.println("RNDIS running...");
  25.     timer = millis();
  26.   }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment