Go Down

Topic: sketch good / schematic doesn't work (Read 24 times) previous topic - next topic

imh747

Hi veryone,   :)

I need some help.
I'm new in programming.
How do you improve skills in Arduino.
Do you advise learning C++ before learning Arduino?

Here is a sketch that looks good. The compilation is great but, nothing happened in the schematic with SIMULIDE.

Thank you very much

-----
const int buttonAPin = 2;  // Enter
const int buttonBPin = 4;  // Menu
const int buttonCPin = 7; // Zoom in

const int ledAPin = A5;
const int ledBPin = A6;
const int ledCPin = A7;

// Variable will change:
int buttonAState = 0;
int buttonBState = 0;
int buttonCState = 0;

void setup() {
// Initialize the button pin as input:
  pinMode(2, INPUT);
  pinMode(4, INPUT);
  pinMode(7, INPUT);
// Initialize the LED pinas an output:
  pinMode(ledAPin, OUTPUT);
  pinMode(ledBPin, OUTPUT);
  pinMode(ledCPin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  buttonAState = digitalRead(buttonAPin);
  buttonBState = digitalRead(buttonBPin);
  buttonCState = digitalRead(buttonCPin);

  if (buttonAState == HIGH) {
    digitalWrite(ledAPin, HIGH);   
      } else {
        digitalWrite(ledAPin, LOW);
      }
  if (buttonBState == HIGH) {
        digitalWrite(ledAPin, HIGH);   
      } else {
        digitalWrite(ledAPin, LOW);
       }
  if (buttonCState == HIGH) {
        digitalWrite(ledAPin, HIGH);
      } else {
        digitalWrite(ledAPin, LOW);
      }
}



Go Up