Go Down

Topic: Arduino / genuino uno istruzione delay() (Read 137 times) previous topic - next topic

gian_marco

in questo sketch è presente l'istruzione delay(300),
in fase di compilazione segnala errore exit status 1
Se elimino l'istruzione delay() il progetto viene compilato senza errori


const int buttonPin = 2;
const int stopPin = 3;// the number of the pushbutton pin
const int ledPin =  13;
int inByte = 0;         // incoming serial byte// the number of the LED pin
int buttonState = 0;
int stopState = 0;// variable for reading the pushbutton status

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
    // initialize the LED pin as an output:
    pinMode(ledPin, OUTPUT);
    // initialize the pushbutton pin as an input:
    pinMode(buttonPin, INPUT);
    pinMode(stopPin, INPUT);
  }
}

void loop() {
 
  buttonState = digitalRead(buttonPin);
  stopState = digitalRead(stopPin);

  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
    Serial.println(1);   // send a capital A
    digitalWrite (ledPin, LOW);
    delay (300);
    Serial.println (0);

  }
  if (stopState == HIGH) {
    Serial.println (2);
  }

ExperimentUno

Secondo me è un errore del linker.
Posta il messaggio d'errore per intero.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy