hola chicos alguien que pueda modificar este esquema en el que se utiliza la función delay en una función idéntica utilizando los millis? Necesito esto para ser capaz de aceptar entradas de Arduino Uno por control remoto.
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#include <IRremote.h> // usa libreria IR
int receiver = 7; // Ricevitore IR digital pin 7
IRrecv irrecv(receiver); // create instance of 'irrecv'
decode_results results;
void setup()
{
pinMode(8, OUTPUT); //Initiates Motor Channel A pin
pinMode(9, OUTPUT); //Initiates Brake Channel A pin
pinMode(10,OUTPUT);//output
Serial.begin(9600); // for serial monitor output
irrecv.enableIRIn(); // Start the receiver
pinMode(13, OUTPUT); // Pin 13 output led
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print(" IL PASSATEMPO");
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(" SELEZIONA PROG");
}
void loop()
{
if (irrecv.decode(&results)) // have we received an IR signal?
{
Serial.println(results.value, HEX); // display it on serial monitor in hexadecimal
irrecv.resume();// receive the next value
}
{
while ( results.value == 0xFF30CF || results.value == 0xFF30CF ) //tasto 1 sul telecomando
{
digitalWrite(13, HIGH); // set the LED on
lcd.setCursor(0, 1); // (note: line 1 is the second row, since counting begins with 0):
lcd.print(" PROGRAMMA 001"); // print the number of seconds since reset:
//forward @ full speed
digitalWrite(8, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW); //Disengage the Brake for Channel A
analogWrite(10, 255); //Spins the motor on Channel A at full speed
delay(600000); //gira 10 minuti orario
digitalWrite(9, HIGH); //Eengage the Brake for Channel A
delay(120000); //freno motore per 2 minuti
digitalWrite(8, LOW); //Establishes backward direction of Channel A
digitalWrite(9, HIGH); //Disengage the Brake for Channel A
analogWrite(10, 255); //Spins the motor on Channel A at half speed
delay(600000); //gira 10 minuti antiorario
digitalWrite(8, HIGH); //Eengage the Brake for Channel A
digitalWrite(13, LOW);
delay(3600000); //si ferma tutto per 1 ora
}
}
{
while ( results.value == 0xFF18E7 || results.value == 0xFF18E7 ) //tasto 2 sul telecomando
{
digitalWrite(13, HIGH); // set the LED on
lcd.setCursor(0, 1); // (note: line 1 is the second row, since counting begins with 0):
lcd.print(" PROGRAMMA 002"); // print the number of seconds since reset:
//forward @ full speed
digitalWrite(8, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW); //Disengage the Brake for Channel A
analogWrite(10, 255); //Spins the motor on Channel A at full speed
delay(300000); //gira 5 minuti orario
digitalWrite(9, HIGH); //Eengage the Brake for Channel A
delay(60000); //freno motore per 1 minuti
digitalWrite(8, LOW); //Establishes backward direction of Channel A
digitalWrite(9, HIGH); //Disengage the Brake for Channel A
analogWrite(10, 255); //Spins the motor on Channel A at half speed
delay(300000); //gira 10 minuti antiorario
digitalWrite(8, HIGH); //Eengage the Brake for Channel A
digitalWrite(13, LOW);
delay(1800000); //si ferma tutto per 30 minuti
}
}
{
while ( results.value == 0xFF7A85 || results.value == 0xFF7A85 ) //tasto 3 sul telecomando
{
digitalWrite(13, HIGH); // set the LED on
lcd.setCursor(0, 1); // (note: line 1 is the second row, since counting begins with 0):
lcd.print(" PROGRAMMA 003"); // print the number of seconds since reset:
//forward @ full speed
digitalWrite(8, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW); //Disengage the Brake for Channel A
analogWrite(10, 200); //Spins the motor on Channel A at full speed
delay(600000); //gira 10 minuti orario
digitalWrite(9, HIGH); //Eengage the Brake for Channel A
delay(120000); //freno motore per 2 minuti
digitalWrite(8, LOW); //Establishes backward direction of Channel A
digitalWrite(9, HIGH); //Disengage the Brake for Channel A
analogWrite(10, 200); //Spins the motor on Channel A at half speed
delay(600000); //gira 10 minuti antiorario
digitalWrite(8, HIGH); //Eengage the Brake for Channel A
digitalWrite(13, LOW);
delay(3600000); //si ferma tutto per 1 ora
}
}
{
while ( results.value == 0xFF10EF || results.value == 0xFF10EF ) //tasto 4 sul telecomando
{
digitalWrite(13, HIGH); // set the LED on
lcd.setCursor(0, 1); // (note: line 1 is the second row, since counting begins with 0):
lcd.print(" PROGRAMMA 004"); // print the number of seconds since reset:
//forward @ full speed
digitalWrite(8, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW); //Disengage the Brake for Channel A
analogWrite(10, 200); //Spins the motor on Channel A at full speed
delay(300000); //gira 5 minuti orario
digitalWrite(9, HIGH); //Eengage the Brake for Channel A
delay(60000); //freno motore per 1 minuti
digitalWrite(8, LOW); //Establishes backward direction of Channel A
digitalWrite(9, HIGH); //Disengage the Brake for Channel A
analogWrite(10, 200); //Spins the motor on Channel A at half speed
delay(300000); //gira 10 minuti antiorario
digitalWrite(8, HIGH); //Eengage the Brake for Channel A
digitalWrite(13, LOW);
digitalWrite(15, LOW);
delay(1500000); //si ferma tutto per 25 minuti
}
}
}
gracias