Jump to content

Help Me With My code

Hi!
I need help with making this code work, the comments is mostly in norwegian but i hope one of you can help me ASAP!

Thanks before hand!

Jóni 

trafikklys_med_knapp.ino

Link to comment
Share on other sites

Link to post
Share on other sites

Hi @Nimgg,

 

From looking at this, I'm guessing that you are wanting a traffic light system to work?

 

It's quite hard to get code to work if you don't know what it's supposed to do :)

 

Josh

I will only ever answer to the best of my ability - there is absolutely no promises that I will be correct. Or helpful. At all.

 

My toaster:

Spoiler

CPU: Intel Core i5-4670k @ 4.3GHz
Motherboard: Asus Maximus VI Formula
RAM: 16GB Corsair Vengeance DDR3
GPU: Nvidia GeForce GTX770 2GB
Case: Some free Sharkoon case
Storage: Crucial MX500 500GB SSD | Western Digital Blue 1TB
PSU: Corsair HX750
Display(s): Acer framless 24" 1080p thing | Acer 22" 1600x900 thing
Cooling: Corsair H100i AIO | 2 x Corsair LL120 front intakes on radiator | 1 x Corsair LL120 rear exhaust
Keyboard: Steelseries Apex
Mouse: R.A.T 7
Sound: HyperX Cloud II headset | Creative EAX 5.1 speakers
OS: Windows 10 Pro

 

Link to comment
Share on other sites

Link to post
Share on other sites

@MrJoosh

yeah its a traffic ligth, with a button, im shamed of my self for not being able to make it work

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, Nimgg said:

@MrJoosh

yeah its a traffic ligth, with a button, im shamed of my self for not being able to make it work

I think the attached should work, but i don;t have an Arduino with me as i'm at work :)

 

Let me know :)

trafikklys_med_knapp_JJ.ino

I will only ever answer to the best of my ability - there is absolutely no promises that I will be correct. Or helpful. At all.

 

My toaster:

Spoiler

CPU: Intel Core i5-4670k @ 4.3GHz
Motherboard: Asus Maximus VI Formula
RAM: 16GB Corsair Vengeance DDR3
GPU: Nvidia GeForce GTX770 2GB
Case: Some free Sharkoon case
Storage: Crucial MX500 500GB SSD | Western Digital Blue 1TB
PSU: Corsair HX750
Display(s): Acer framless 24" 1080p thing | Acer 22" 1600x900 thing
Cooling: Corsair H100i AIO | 2 x Corsair LL120 front intakes on radiator | 1 x Corsair LL120 rear exhaust
Keyboard: Steelseries Apex
Mouse: R.A.T 7
Sound: HyperX Cloud II headset | Creative EAX 5.1 speakers
OS: Windows 10 Pro

 

Link to comment
Share on other sites

Link to post
Share on other sites

@MrJoosh

 

 

i still get this as an error message:

"expected primary-expression before ')' token arduino"

the error is on the Else command here:
void loop() {
  "  if (digitalRead(button) == HIGH){
        delay(15); //pause i programmet
        if (digitalRead(button) == HIGH) {
            // når du trykker ned knappen forandrer lyset seg 
      // When you press the button, the light changes
      changeLights();
        }      
    } else();{
    delay(15000); // stopper i 15sek
  }
}"

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Nimgg said:

@MrJoosh

 

 

i still get this as an error message:

"expected primary-expression before ')' token arduino"

the error is on the Else command here:
void loop() {
  "  if (digitalRead(button) == HIGH){
        delay(15); //pause i programmet
        if (digitalRead(button) == HIGH) {
            // når du trykker ned knappen forandrer lyset seg 
      // When you press the button, the light changes
      changeLights();
        }      
    } else();{
    delay(15000); // stopper i 15sek
  }
}"

Sorry, mb, remove the brackets and semi-colon from the else line:

void loop() {
    if (digitalRead(button) == HIGH){
        delay(15); //pause i programmet
        if (digitalRead(button) == HIGH) {
            // når du trykker ned knappen forandrer lyset seg 
			// When you press the button, the light changes
			changeLights();
        }      
    } else {
		delay(15000); // stopper i 15sek
	}
}

Josh

I will only ever answer to the best of my ability - there is absolutely no promises that I will be correct. Or helpful. At all.

 

My toaster:

Spoiler

CPU: Intel Core i5-4670k @ 4.3GHz
Motherboard: Asus Maximus VI Formula
RAM: 16GB Corsair Vengeance DDR3
GPU: Nvidia GeForce GTX770 2GB
Case: Some free Sharkoon case
Storage: Crucial MX500 500GB SSD | Western Digital Blue 1TB
PSU: Corsair HX750
Display(s): Acer framless 24" 1080p thing | Acer 22" 1600x900 thing
Cooling: Corsair H100i AIO | 2 x Corsair LL120 front intakes on radiator | 1 x Corsair LL120 rear exhaust
Keyboard: Steelseries Apex
Mouse: R.A.T 7
Sound: HyperX Cloud II headset | Creative EAX 5.1 speakers
OS: Windows 10 Pro

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×