Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
arduino [2023/11/21 17:28] – [Flipper] geraldarduino [2024/04/20 17:22] (aktuell) – [Joystick] gerald
Zeile 21: Zeile 21:
 [[https://create.arduino.cc/projecthub/Frogger1108/arduino-conversion-of-an-em-pinball-machine-b2f318]] [[https://create.arduino.cc/projecthub/Frogger1108/arduino-conversion-of-an-em-pinball-machine-b2f318]]
  
-Joystick+==== Joystick ==== 
  
 Für Leonardo oder Micro (nur die verwalten den USB-Anschluss selbst und könnten dadurch Keyboards, Joysticks etc. emulieren). Für Leonardo oder Micro (nur die verwalten den USB-Anschluss selbst und könnten dadurch Keyboards, Joysticks etc. emulieren).
 +
 +Quelle((https://www.instructables.com/Create-a-Joystick-Using-the-Arduino-Joystick-Libra/)) 
 +
 +Out of the box the Arduino Leonardo and the Arduino Micro appear to the host computer as a generic keyboard and mouse. This article discusses how the Arduino Leonardo and the Arduino Micro can also appear as one or more generic Game Controllers or Joysticks. The Arduino Joystick Library Version 2.0 can be used with Arduino IDE 1.6.6 (or above) to add one or more joysticks (or gamepads) to the list of HID devices an Arduino Leonardo or Arduino Micro (or any Arduino clone that is based on the ATmega32u4) can support. This will not work with Arduino IDE 1.6.5 (or below) or with non-32u4 based Arduino devices (e.g. Arduino UNO, Arduino MEGA, etc.).
 +
 +
 +The joystick or gamepad can have the following features:
 +
 +  * Buttons (default: 32)
 +  * Up to 2 Hat Switches
 +  * X, Y, and/or Z Axis (up to 16-bit precision)
 +  * X, Y, and/or Z Axis Rotation (up to 16-bit precision)
 +  * Rudder (up to 16-bit precision)
 +  * Throttle (up to 16-bit precision)
 +  * Accelerator (up to 16-bit precision)
 +  * Brake (up to 16-bit precision)
 +  * Steering (up to 16-bit precision) 
 +
 +These features are configured using the Joystick_ class’s constructor.
 +
 +
 +The latest build of Version 2.0 of the Arduino Joystick Library can be downloaded from the following GitHub repository:
 +
 +[[https://github.com/MHeironimus/ArduinoJoystickLibrary/tree/version-2.0]]
 +
 +The library can also be downloaded directly using the following: [[https://github.com/MHeironimus/ArduinoJoystickLibrary/archive/version-2.0.zip]]
 +
  
 Quelle((https://www.instructables.com/Arduino-LeonardoMicro-as-Game-ControllerJoystick/)) Quelle((https://www.instructables.com/Arduino-LeonardoMicro-as-Game-ControllerJoystick/))
Zeile 38: Zeile 66:
 The latest version of the Arduino library that allows the Arduino Leonardo and Micro to appear as a Game Controller can be downloaded from the following GitHub repository: The latest version of the Arduino library that allows the Arduino Leonardo and Micro to appear as a Game Controller can be downloaded from the following GitHub repository:
  
-[[https://github.com/MHeironimus/ArduinoJoystickLibrary/tree/version-1.0]]+[[https://github.com/MHeironimus/ArduinoJoystickLibrary]]
  
 This GitHub repository actually contains three different versions of the Arduino Joystick Library: This GitHub repository actually contains three different versions of the Arduino Joystick Library:
Zeile 47: Zeile 75:
  
 {{ ::arduinojoysticklibrary-version-1.0.zip |}} {{ ::arduinojoysticklibrary-version-1.0.zip |}}
 +
 +
 +==== Bewässerungsautomatik ====
 +
 +
 +4 Pumpen, 4 Feuchtigkeitssensoren, Board mit 4 Relais bei Ali für cs 13 EU.
 +
 +{{::4bewaesserung_ali.png?400|}}
 +
 +{{:4bewaesserung.png?400|}}
 +
 +Quelle((https://forum.arduino.cc/t/capacitive-soil-moisture-sensor-4-relay/1244826/6))
 +
 +<code>
 +const byte channels = 3;
 +const byte relayPin[channels] = {3, 5, 7}; // Pins controlling the relays
 +const byte moisturePin[channels] = {A0, A1, A2}; // Analog pins connected to the moisture sensors
 +const int threshold[channels] = {350, 400, 400}; // Adjust these values based on your soil conditions
 +const byte moisturePinTorr = A3; // Analog pins connected to the moisture sensors
 +const int thresholdTorr = 530; // Adjust these values based on your soil conditions
 +
 +void setup() {
 +  Serial.begin(9600);
 +  for (byte c=0; c<channels; c++) {
 +    pinMode(moisturePin[c], INPUT);
 +    pinMode(relayPin[c], OUTPUT);
 +  }
 +  pinMode(moisturePinTorr, INPUT);
 +}
 +
 +void loop() {
 +  int moistureLeveltorr = analogRead(moisturePinTorr);
 +  for (byte c=0; c<channels; c++) {
 +    int moistureLevel = analogRead(moisturePin[c]);
 +
 +    if (moistureLevel > threshold[c] && moistureLeveltorr < thresholdTorr) {
 +      Serial.print("Soil moisture ");
 +      Serial.print(c);
 +      Serial.println(" is DRY => activating pump");
 +      digitalWrite(relayPin[c], LOW);  // Turn on the pump
 +
 +      // Decide how long the pump should run (e.g., 5-10 seconds)
 +      int pumpRunTime = random(15, 19);  // Random time between 5 and 10 seconds
 +      delay(pumpRunTime * 1000);         // Convert to milliseconds
 +</code>
 +
 +
 +3 pumps and 3 relay coils are too much load on USB supply, you need a separate 5 volt supply of at least 2 Amps. Also, you should have a kickback suppression diode in parallel with each pump, cathode (end with band) toward + (positive) voltage.
  
  
  
 
Nach oben
arduino.1700587686.txt.gz · Zuletzt geändert: 2024/02/29 13:36 (Externe Bearbeitung)
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0
DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp   Dogecoin Donations Accepted Here    DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp  DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp