Arduino – die besten Beiträge

Arduino 32 Segment Display Counter programmieren?

Hi,

wie kann ich bei einem Arduino 32 Segment Display einen Counter programmieren der von 9 auf 0 runter geht? Ich habe mir zuerst dieses Standart BSP von `Hello World `: Das ist der Script:

/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
Library originally added 18 Apr 2008
by David A. Mellis
library modified 5 Jul 2009
by Limor Fried (http://www.ladyada.net)
example added 9 Jul 2009
by Tom Igoe
modified 22 Nov 2010
by Tom Igoe
modified 7 Nov 2016
by Arturo Guadalupi
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/LiquidCrystalHelloWorld
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Motor startet in:");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(8,2);
// print the number of seconds since reset:
lcd.print(millis() / 1000);
}

Danke im voraus :-).

programmieren, Arduino, Arduino Uno

Ersatz für delay(); in einem Arduino Nano gesucht?

ich benötige einen Ersatz für Delay, der die Ausführung von Subroutinen nicht behindert.

Es geht mir dabei nicht um das Blinken einer LED, sondern um die exakte Taktung mit der void loop() wiederholt wird.

hat hier jemand eine schlaue Idee

void loop() {
DateTime now = rtc.now();


// Delay-Ausgleich für den Countdown
if (Timer == 0) {
  Timer = Countdown;
  }
if (timeshift < 4)
  {
  timeshift++;
  }
else
  {
 timeshift = 0; 
 Timer--;
  }
Temperatur = rtc.getTemperature();
Temperatur = (float)Temperatur;


//Sonnenrichtungssensoren auslesen
LDR_up = analogRead(A0) + 20; // Sensorkalibrierung
LDR_west = analogRead(A2) + 45;  // Sensorkalibrierung
LDR_east = analogRead(A3); 
LDR_down = analogRead(A3);
Gesamtwert = LDR_up + LDR_west + LDR_east + LDR_down; // Gesamtmenge Licht

if (Helligkeitsglaettung > 0)
  {
  smooth_lumen();
  }
else
  {
  GM_Lumen = round(Gesamtwert / 10)*10;
  }

//Zeitformatierung Countdown
hours = floor(Timer/3600);
minutes = floor(Timer/60-(hours*60));
seconds = floor(Timer-((hours*3600)+(minutes*60)));

//Potiprozent berechnen
Potentiometerwert = analogRead(A6);
Potentiometerdifferenz = Potentiometerwert - Potentiometerminimum;
Potentiometerproz = 50.0 / Potentiometermax * Potentiometerdifferenz;
Potentiometeranz = 100 - (int)Potentiometerproz;

// Hinweise zur Richtungssteuerung:
 // digitalWrite(RELAISX, HIGH); // LOW = nach Osten HIGH = nach Westen
 // digitalWrite(RELAISZ, LOW); // LOW = nach Oben / HIGH = nach Unten

//  digitalWrite(RELAIS_PowerX, LOW); // LOW = Power On / HIGH = Power off
//  digitalWrite(RELAIS_PowerZ, LOW); //LOW Power On / HIGH = Power off

anemometer(); // Anemometer auswerten

// Wetter- und Lichtabhängiger Algorithmus für die Solarsteuerung
if (now.hour() == 3 && now.minute() == 0 && now.second() == 0) // Zeitpunkt für Korrektur der horizontalen 0-Position
  {
  angel_reset = 1;
  }
if (Temperatur > Mindesttemperatur)
  {
  if (Windmaximum < rpm)
    {
    storm_protection();
    }
  else if(angel >= -30 && angel_reset == 1)
    {
    angle_reset();
    }  
  else if (GM_Lumen < Mindesthelligkeit) 
    {// zu wenig Licht - die Anlage soll in die Neutralstellung fahren
    neutral_position();
    }
  else // Nachfuehrung im Normalbetrieb
    {
    solar_move();
    }
  }
// Anzeige für HD44780 2004 LCD (i2c) Display formatieren
show_display();
delay(200);
}
Arduino, Code, Programmiersprache, Zeit, Delay, Taktung

Meistgelesene Beiträge zum Thema Arduino