Advertisement
Monarch73

arduino nano32 sample code

Nov 3rd, 2024 (edited)
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.03 KB | None | 0 0
  1. #define RED_PIN 25
  2. #define GREEN_PIN 26
  3. #define BLUE_PIN 27
  4.  
  5. void setup()
  6. {
  7.     Serial.begin(115200);
  8.     pinMode(RED_PIN, OUTPUT);
  9.     pinMode(GREEN_PIN, OUTPUT);
  10.     pinMode(BLUE_PIN, OUTPUT);
  11.     int zahl = analogRead(A0);
  12.     Serial.println("Hallo Welt");
  13.     Serial.println(zahl);
  14. }
  15.  
  16. void loop()
  17. {
  18.     // Setze die RGB-LED auf Rot
  19.     analogWrite(RED_PIN, 255);
  20.     analogWrite(GREEN_PIN, 0);
  21.     analogWrite(BLUE_PIN, 0);
  22.     delay(1000);
  23.  
  24.     // Setze die RGB-LED auf Grün
  25.     analogWrite(RED_PIN, 0);
  26.     analogWrite(GREEN_PIN, 255);
  27.     analogWrite(BLUE_PIN, 0);
  28.     delay(1000);
  29.  
  30.     // Setze die RGB-LED auf Blau
  31.     analogWrite(RED_PIN, 0);
  32.     analogWrite(GREEN_PIN, 0);
  33.     analogWrite(BLUE_PIN, 255);
  34.     delay(1000);
  35.  
  36.     // Setze die RGB-LED auf Weiß
  37.     analogWrite(RED_PIN, 255);
  38.     analogWrite(GREEN_PIN, 255);
  39.     analogWrite(BLUE_PIN, 255);
  40.     delay(1000);
  41.  
  42.     // Setze die RGB-LED auf Aus
  43.     analogWrite(RED_PIN, 0);
  44.     analogWrite(GREEN_PIN, 0);
  45.     analogWrite(BLUE_PIN, 0);
  46.     delay(1000);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement