I have this project I have to do and I was wondering how do I go about programming an adder like this?
It will be using LEDs and it needs to show user input and then add the two values in binary?
Any pointers?
I am completely new with arduino and that stuff, as for wiring i have an idea and how to communicate the software to the correct pins. (in other words i know how to program an LED to turn off/on) etc but would it just be some boolean values for on and off? I don't know please help. (I do program in c++ and i hear that it is similar to the arduino language)
So like it would be something along the lines of...
int buttonA = 5; // change value if you used a different digital I/O pin
int buttonB = 7;
void setup(){
pinMode(buttonA, INPUT); //for user input
pinMode(buttonB, INPUT);
pinMode(10, OUTPUT);
pinMode(12, OUTPUT);
}
void loop(){
int inputA = digitalRead(buttonA); // read voltage on pin, store value in variable
if(inputA == 1){ // if button is pressed
digitalWrite(10, HIGH); // turn on LED on pin 10
}
else{ // else (if button is not pressed)
digitalWrite(10, LOW); // turn off LED on pin 10
}
}
then what how do I add the two inputted values what + what? Thanks for the help btw
its just adding and displaying the value is whats getting me
So they just go to the device and press a button and itll cycle through all the choices, then there will be another button to confirm their choice, then the same for the next addend then another button is pressed again to show the final result.
looking from a top view....
LED, LED, LED, LED, LED {Row 1 of LEDs} Store 1st addend
LED, LED, LED, LED, LED {Row 2 of LEDs} Store 2nd addend
LED, LED, LED, LED, LED {Row 3 of LEDs} Store answer (binary)