This is my first time doing this type of thing and I have no background in coding.
It will compile however the code won't upload and I've been working on this for days.
Any help you can provide would be very much appreciated.
Error messages:
Arduino: 1.8.8 (Windows 10), Board: "Arduino/Genuino Uno"
Sketch uses 1898 bytes (5%) of program storage space. Maximum is 32256 bytes.
Global variables use 13 bytes (0%) of dynamic memory, leaving 2035 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM4 -b115200 -D -Uflash:w:C:\Users\CHRIST~1\AppData\Local\Temp\arduino_build_870585/sketch_apr18.ino.hex:i
avrdude: Version 6.3-20171130
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x9c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x9c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x9c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x9c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x9c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x9c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x9c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x9c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x9c
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x9c
avrdude done. Thank you.
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Code:
void setup() {
//constants
// set pin numbers:
int buttonPin1 = 6; //pushbutton pins
int buttonPin2 = 7;
int buttonPin3 = 8;
int buttonPin4 = 9;
int buttonPin5 = 10;
int buttonPin6 = 11;
int const led1 = 0; //led pins
int const led2 = 1;
int const led3 = 2;
int const led4 = 3;
int const led5 = 4;
int const led6 = 5;
//variables
//led pins as outputs
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
//pushbuttons as inputs
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(buttonPin4, INPUT);
pinMode(buttonPin5, INPUT);
pinMode(buttonPin6, INPUT);
//activating leds
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
//selecting leds to begin game
int ran1 = random(0, 1);
int ran2 = random(0, 1);
int ran3 = random(0, 1);
int ran4 = random(0, 1);
int ran5 = random(0, 1);
int ran6 = random(0, 1);
//ensuring 6 led=LOW does not occur | approximatley .02 percent chance running random code twice
if (ran1 == 0) {
if (ran2 == 0) {
if (ran3 == 0) {
if (ran4 == 0) {
if (ran5 == 0) {
if (ran6 == 0) {
int ran1 = random(0, 1);
int ran2 = random(0, 1);
int ran3 = random(0, 1);
int ran4 = random(0, 1);
int ran5 = random(0, 1);
int ran6 = random(0, 1);
}
}
}
}
}
}
if (ran1 == 1) {
digitalWrite(led1, HIGH);
}
else {
digitalWrite(led1, LOW);
}
if (ran2 == 1) {
digitalWrite(led2, HIGH);
}
else {
digitalWrite(led2, LOW);
}
if (ran3 == 1) {
digitalWrite(led3, HIGH);
}
else {
digitalWrite(led3, LOW);
}
if (ran4 == 1) {
digitalWrite(led4, HIGH);
}
else {
digitalWrite(led4, LOW);
}
if (ran5 == 1) {
digitalWrite(led5, HIGH);
}
else {
digitalWrite(led5, LOW);
}
if (ran6 == 1) {
digitalWrite(led6, HIGH);
}
else {
digitalWrite(led6, LOW);
}
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
int buttonState6 = 0;
}
void loop() {
//constants
// set pin numbers:
int buttonPin1 = 6; //pushbutton pins
int buttonPin2 = 7;
int buttonPin3 = 8;
int buttonPin4 = 9;
int buttonPin5 = 10;
int buttonPin6 = 11;
int const led1 = 0; //led pins
int const led2 = 1;
int const led3 = 2;
int const led4 = 3;
int const led5 = 4;
int const led6 = 5;
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
int buttonState6 = 0;
//read each pushbutton
buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);
buttonState3 = digitalRead(buttonPin3);
buttonState4 = digitalRead(buttonPin4);
buttonState5 = digitalRead(buttonPin5);
buttonState6 = digitalRead(buttonPin6);
// check if the pushbutton is pressed
//button for leds 3 and 6
if (buttonState1 == HIGH) {
if (led3 == HIGH) {
digitalWrite(led3, LOW);
}
else {
digitalWrite(led3, HIGH);
}
if (led5 == HIGH) {
digitalWrite(led6, LOW);
}
else {
digitalWrite(led6, HIGH);
}
}
//button for leds 1 and 4
if (buttonState2 == HIGH) {
if (led1 == HIGH) {
digitalWrite(led1, LOW);
}
else {
digitalWrite(led1, HIGH);
}
if (led4 == HIGH) {
digitalWrite(led4, LOW);
}
else {
digitalWrite(led4, HIGH);
}
}
//button for leds 2 and 5
if (buttonState3 == HIGH) {
if (led2 == HIGH) {
digitalWrite(led2, LOW);
}
else {
digitalWrite(led2, HIGH);
}
if (led5 == HIGH) {
digitalWrite(led5, LOW);
}
else {
digitalWrite(led5, HIGH);
}
}
//button for leds 2 and 6
if (buttonState4 == HIGH) {
if (led2 == HIGH) {
digitalWrite(led2, LOW);
}
else {
digitalWrite(led2, HIGH);
}
if (led6 == HIGH) {
digitalWrite(led6, LOW);
}
else {
digitalWrite(led6, HIGH);
}
}
//button for leds 1 and 5
if (buttonState5 == HIGH) {
if (led1 == HIGH) {
digitalWrite(led1, LOW);
}
else {
digitalWrite(led1, HIGH);
}
if (led5 == HIGH) {
digitalWrite(led5, LOW);
}
else {
digitalWrite(led5, HIGH);
}
}
//button for leds 3 and 4
if (buttonState6 == HIGH) {
if (led3 == HIGH) {
digitalWrite(led3, LOW);
}
else {
digitalWrite(led3, HIGH);
}
if (led4 == HIGH) {
digitalWrite(led4, LOW);
}
else {
digitalWrite(led4, HIGH);
}
}
//flash all lights once for winning
if (led1 == LOW) {
if (led2 == LOW) {
if (led3 == LOW) {
if (led4 == LOW) {
if (led5 == LOW) {
if (led6 == LOW) {
digitalWrite(led1, HIGH);
delay(1500);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
delay(1500);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
delay(1500);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
delay(1500);
digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
delay(1500);
digitalWrite(led5, LOW);
digitalWrite(led6, HIGH);
delay(1500);
digitalWrite(led6, LOW);
}
}
}
}
}
}
}