Code für dein Starter Kit


Im mitgelieferten Handbuch zum Starter Kit findest du alle Erläuterungen zum Code und natürlich alle Bauteile, damit dir jedes Projekt gelingt!

int LED = 6;

 

void setup() {    

 

 pinMode(LED, OUTPUT);

}

 

void loop() {

 

 

 digitalWrite (LED, HIGH);

 

}

int LED1 = 10;

int LED2 = 11;

 

void setup() {       

 

pinMode(LED1, OUTPUT);

pinMode(LED2, OUTPUT);

 

}

 

void loop() {

 digitalWrite(LED1, HIGH);

 digitalWrite(LED2, LOW);

 delay(500);               

 digitalWrite(LED1, LOW);   

 digitalWrite(LED2, HIGH);

 delay(500);

}

int LEDgruen = 5;

int LEDrot = 6;

int TasterSlot = 2;

int tasteDruck = 0;

 

void setup() {     

 

pinMode(LEDgruen, OUTPUT);

pinMode(LEDrot, OUTPUT);

pinMode (TasterSlot, INPUT);

}

 

void loop() {

 

 digitalWrite(LEDrot, HIGH);

 

 

 tasteDruck = digitalRead(TasterSlot);

 

 if (tasteDruck == HIGH){

   delay(1000);             

   digitalWrite(LEDrot, LOW);  

   delay(500);

   digitalWrite(LEDgruen, HIGH);

   delay(2000);

   digitalWrite(LEDgruen, LOW);

   delay(500);

   digitalWrite(LEDrot, HIGH);

 }

}

int sensorPin = A0;

float BasisTemperatur = 20.0;

 

void setup() {

 Serial.begin(9600);

 

   for(int pinNummer = 2; pinNummer < 5; pinNummer++) {

 

     pinMode(pinNummer, OUTPUT);

     digitalWrite(pinNummer, LOW);

   }

}

 

 

void loop() {

 int sensorWert = analogRead(sensorPin);

 Serial.print(“Sensor Wert: “);

 Serial.print(sensorWert);

 

 float Spannung = (sensorWert/1024.0) * 5.0;

 Serial.print (“, Spannung: “);

 Serial.print(Spannung);

 float Temperatur = (Spannung – .5) * 100;

 Serial.print(“,Grad C: “);

 Serial.println(Temperatur);

 

 if (Temperatur < BasisTemperatur) {

   digitalWrite(2, LOW);

   digitalWrite(3, LOW);

   digitalWrite(4 ,LOW);

 } else if(Temperatur >= BasisTemperatur+2 &&

   Temperatur < BasisTemperatur+4) {

     digitalWrite(2, HIGH);

     digitalWrite(3, LOW);

     digitalWrite(4 ,LOW);

   }else if(Temperatur >=BasisTemperatur+4 &&

     Temperatur < BasisTemperatur+6) {

       digitalWrite(2, HIGH);

       digitalWrite(3, HIGH);

       digitalWrite(4, LOW);

     } else if(Temperatur >= BasisTemperatur+6) {

        digitalWrite(2, HIGH);

        digitalWrite(3, HIGH);

        digitalWrite(4, HIGH);

     }

     delay(1);

}

 

int LED1 = 5;

int LED2 = 6;

int LED3 = 9;

int LED4 = 10;

int Sirene = 7;

 

 

int wertFaden = 0;    

int stufenFaden = 5;

 

void setup() {       

 

 

pinMode(Sirene, OUTPUT);

 

 

}

 

void loop() {

 

analogWrite(LED1, wertFaden);

analogWrite(LED2, wertFaden);

analogWrite(LED3, wertFaden);

analogWrite(LED4, wertFaden);

 

 

delay(10);

 

 

wertFaden = wertFaden + stufenFaden;

 

 

if (wertFaden == 0 || wertFaden == 250) {

stufenFaden = -stufenFaden;

}

 

 

if (wertFaden <= 125) {

 tone(Sirene, 655);

 } else {

 tone(Sirene, 400);

 }

 

}

int piezo=8;

int pir=7;

int led=9;

int ablauf=1;

int bewegung=0;

 

void setup() {       

 

 

pinMode(piezo, OUTPUT);

pinMode(led, OUTPUT);

pinMode(pir, INPUT);

}

 

void loop() {

 

bewegung = digitalRead(pir);

 

 

if (bewegung == HIGH) {

 for (ablauf = 1; ablauf < 6; ablauf++) {

   tone(piezo, 500);

   digitalWrite(led, HIGH);

   delay(1000);

   noTone(piezo);

   digitalWrite(led, LOW);

   delay(1000); } /* Hier endet die for-Schleife */

 

 

} else {

  digitalWrite(led, LOW);

  digitalWrite(piezo, LOW);

}

 

}

int switchWert1 = 0;

int switchWert2 = 0;

 

 

int TASTER1 = 2;

int TASTER2 = 9;

int LED1 = 3;

int LED2 = 5;

int TON = 4;

 

void setup() {    

 

 pinMode(LED1, OUTPUT);

 pinMode(LED2, OUTPUT);

 pinMode(TON, OUTPUT);

 pinMode(TASTER1, INPUT);

 pinMode(TASTER2, INPUT);

 

}

void loop() {    

 

 switchWert1 = digitalRead(TASTER1);

 switchWert2 = digitalRead(TASTER2);

 

 

 if (switchWert1 == LOW) {

   digitalWrite(LED1, LOW);

 } else {

   digitalWrite(LED1, HIGH);

   digitalWrite(LED2, LOW);

   tone(TON, 400);

   delay(500);

   noTone(TON);

   delay(3000);

   digitalWrite(LED1, LOW);

 }

 

 

 if (switchWert2 == LOW) {

   digitalWrite(LED2, LOW);

 } else {

   digitalWrite(LED2, HIGH);

   digitalWrite(LED1, LOW);

   tone(TON, 700);

   delay(500);

   noTone(TON);

   delay(3000);

   digitalWrite(LED2, LOW);

}

 

}

int Taster = 6;

int tasteDruck = 0;

int Antwort;

 

void setup() {

 

lcd.begin(16, 2);

 

lcd.print(“Frag das”);

 

 

lcd.setCursor(0, 1);

lcd.print(“CODINO Orakel!”);

 

pinMode(Taster, INPUT);

}  

 

void loop() {

 

 tasteDruck = digitalRead(Taster);

 

if (tasteDruck == HIGH) {

     Antwort = random(8);

 

 

     lcd.clear();

     lcd.setCursor(0, 0);

     lcd.print(“Die Antwort ist:”);

     lcd.setCursor(0, 1);

 

 

switch (Antwort) {

case 0:

         lcd.print(“Ja”);

break;

 

case 1:

         lcd.print(“Wahrscheinlich”);

break;

 

case 2:

         lcd.print(“Sicherlich”);

break;

 

case 3:

         lcd.print(“Sieht gut aus”);

break;

 

case 4:

         lcd.print(“Nicht sicher”);

break;

 

case 5:

         lcd.print(“Frag nochmal!”);

break;

 

case 6:

         lcd.print(“Zweifelhaft”);

break;

 

case 7:

         lcd.print(“Nein”);

break;

     }

   }

}

#include “pitches.h”

/* Siehe nächsten Tab für die Bibliothek pitches.h! */

 

int laut = 7;

 

int noten[] = {NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4};

 

void setup() {

 

Serial.begin(9600);

}

 

void loop() {

 

 

int keyWert = analogRead(A0);

 

Serial.println(keyWert);

 

 

 

 if (keyWert == 1023) {

     tone(laut, noten[0]);

 

 } else if (keyWert >= 990 && keyWert <= 1010) {

   tone(laut, noten[1]);

 

 } else if (keyWert >= 505 && keyWert <= 515) {

   tone(laut, noten[2]);

 

 } else if (keyWert >= 5 && keyWert <= 10) {

   tone(laut, noten[3]);

 

 } else {

   noTone(laut);

  }

}

#define NOTE_C4  262
#define NOTE_D4  294
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_G4  392
#define NOTE_A4  440
#define NOTE_B4  494

#include <LiquidCrystal.h>

#include “pitches.h”

 

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

 

int grueneLED = 6;

int MenuTaster = 7;

int Lautsprecher = 8;

int MenuTasterDruck = 0;

 

int notes[] = {NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_B4};

 

void setup() {

 Serial.begin(9600);

 lcd.begin(16, 2);

 pinMode(MenuTaster, INPUT);

 pinMode(grueneLED, OUTPUT);

 digitalWrite(grueneLED, LOW);

}

 

void loop() {

 int keyWert = analogRead(A0);

 Serial.println(keyWert);

 lcd.noDisplay();

 digitalWrite(grueneLED, LOW);

 if(keyWert > 1000 && keyWert <= 1025)  {

   tone(Lautsprecher, notes[0]); }    

       else if(keyWert > 990 && keyWert <=1010)  {

         tone(Lautsprecher, notes[1]); }

       else if(keyWert > 950 && keyWert <= 970)  {

         tone(Lautsprecher, notes[2]); }

       else if(keyWert > 900 && keyWert <= 945)  {

         tone(Lautsprecher, notes[3]); }

       else if(keyWert > 650 && keyWert <= 710)  {

         tone(Lautsprecher, notes[4]); }

       else if(keyWert > 500 && keyWert <= 550)  {

         tone(Lautsprecher, notes[5]); }

       else if(keyWert > 8 && keyWert <= 10)  {

         tone(Lautsprecher, notes[6]); }

       else if(keyWert < 8)  {

         noTone(Lautsprecher); }

 

 

MenuTasterDruck = digitalRead(MenuTaster);

if (MenuTasterDruck == HIGH)  {

     digitalWrite(grueneLED, HIGH);

     lcd.display();

     lcd.clear();

     menueStart();

     }

 


 

 

 

 

void menueStart()  {

 int keyWert = analogRead(A0);  

 MenuTasterDruck = digitalRead(MenuTaster);

   while (MenuTasterDruck == LOW)  {

     MenuTasterDruck = digitalRead(MenuTaster);

     if (MenuTasterDruck == HIGH)  {

         delay(300);

    

       menueSong1();

 

       lcd.clear();

       break;

       /*

       }

       else   {  

       lcd.clear();

       lcd.setCursor(0, 0);

       lcd.print(“WAEHLE DEINEN”);

       lcd.setCursor(0, 1);

       lcd.print(“SONG!”);

       delay(50);

       }

   } 

 } 

 

 

 

void menueSong1()  {

 

 int keyWert = analogRead(A0);

 MenuTasterDruck = digitalRead(MenuTaster);

 digitalWrite(grueneLED, HIGH);

 

 while (MenuTasterDruck == LOW)  {

   MenuTasterDruck = digitalRead(MenuTaster);

 

 

     if (MenuTasterDruck == HIGH) {

       delay(300);

      

       menueSong2();

 

       lcd.clear();

       break;

       }

     else  {

       int keyWert = analogRead(A0);

       Serial.println(keyWert);

        

        if(keyWert >= 5)  {

          digitalWrite(grueneLED, LOW);

          Song1();

          break;

          }

 

       lcd.clear();

       lcd.setCursor(0, 0);

       lcd.print(“MARIO SONG”);

       lcd.setCursor(0, 1);

       lcd.print(“NUMMER 1”);

       delay(50);

 

     }

   } 

}


Cart

View cart