Please HELP me NOW!!!!!!

I have a problem with one LED. I have read all Forum mails with Search and noone can help me
Here is the Program I have so far

/* Lighting a LED */
#define LED_dig1 1
#define LED_dig2 3
int LED_pin = LED_dig1*10+LED_dig1 ;

void setup() {
  Serial.begin(9600) ;
  int LED_Mode ;
  LED_Mode=OUTPUT ;
  pinMode(LED_pin,LED_Mode) ;
  if (LED_Mode == OUTPUT) Serial.println("LED mode set coirrect") ;
}

void loop () {
  if (LED_pin==13) { // check we are using the right pin
    digitalWrite(LED_dig1*10+LED_dig1,digitalRead(13)) ;
  }
}

How do I stop the program when it finishes ?


No, I do not have a problem. But I just loooove some of the posts in this forum when it is like my (exaggerated? no, not really) example. Especially with a subject like that, typically in an unrelated forum group

(I feel better now :wink: )

You what?

Not sure if you are pulling our leg or not, but that is sure one strange sketch.

Anyway, if your question is a real one:

How do I stop the program when it finishes ?

Then just move everything in the loop function into the end of the setup() function and leave the setup() {} as a simple do nothing empty loop.

Lefty

Please HELP me NOW!!!!!!

When you press the Shift-1 combination, your keyboard appears to stick.

Hope that helps!

 digitalWrite(LED_dig1*10+LED_dig1,digitalRead(13)) ;

What is the point of the line?

Why aren't you using LED_dig2 for anything?
Not sure how you expect to get to 13 when you only have 10+1.

retrolefty:
Not sure if you are pulling our leg or not, but that is sure one strange sketch.

This is the Bar Sports forum, yes? :stuck_out_tongue:

CrossRoads:
Why aren't you using LED_dig2 for anything?

Damn... that sketch was supposed to be "correct". Should have tested it, but it was late ...

Hvad er meningen at den skulle gøre? Kan ikke lige lure hvad det er du forsøger at få den til :stuck_out_tongue:

and noone can help me

Why not ask him:http://www.parsec-santa.com/celebrity/celeb_pages/Peter_Noone.html?

Well, just because ... and for no particular reason at all, and the "cheering up" by the link of AWOL , I now did test it. With the correction pointed out by CrossRoads, and the strange stuff (--> Danish language - YouTube) that bld mentions ... the correct program. It does turn on the onboard LED!!!!!!!!!!!!!!!!!!!!!! (damn, that sticky Shift-1 key)

/* Lighting a LED */
#define LED_dig1 10
#define LED_dig2 3
int LED_pin = LED_dig1+LED_dig2 ;

void setup() {
  Serial.begin(9600) ;
  int LED_Mode ;
  LED_Mode=OUTPUT ;
  pinMode(LED_pin,LED_Mode) ;
  if (LED_Mode == OUTPUT) Serial.println("LED mode set correct") ;
}

void loop () {
  if (LED_pin==13) { // check we are using the right pin
    digitalWrite(LED_dig1+LED_dig2,!digitalRead(13)) ;
  }
}

Kamelåså :smiley:

Still trying to figure out why you are doing it as difficult as possible...

This should work

/* Lighting a LED */
#define LED_dig1 10
#define LED_dig2 3

int LED_pin = LED_dig1+LED_dig2;

void setup()
{
  Serial.begin(9600);

  int LED_Mode;
  LED_Mode = OUTPUT;
  pinMode(LED_pin,LED_Mode);

  if (LED_Mode == OUTPUT) Serial.println("LED mode set correct");

  if (LED_pin==13) // check we are using the right pin
  { 
    digitalWrite(LED_dig1+LED_dig2,!digitalRead(13));
  }
}

void loop ()
{
}

Except it seems strange with the !digitalRead(13)

This will turn it on if it is pin 13

/* Lighting a LED */
#define LED_dig1 13

void setup()
{
  Serial.begin(9600);
  
  int LED_Mode = OUTPUT;
  pinMode(LED_dig1, LED_Mode);

  if (LED_Mode == OUTPUT) Serial.println("LED mode set correct");

  if (LED_dig1 == 13) // check we are using the right pin
  { 
    digitalWrite(LED_dig1, HIGH);
  }
}

void loop ()
{
}

And this is how I would do it...

/* Lighting a LED */
#define LED 13

void setup()
{
  Serial.begin(9600);
  pinMode(LED, OUTPUT);
  digitalWrite(LED, HIGH);
}

void loop ()
{
}

Tested as the shortest possible program to turn on LED13 (measured using normal Arduino source)

void setup(){}void loop(){digitalWrite(13,HIGH);}

To the rest of you readers, there is this "thing" between those Danes from the mainland and those on the main island ... sorry about that :slight_smile:

You need to set it as an output though or it's not properly turned on.

Msquare:
To the rest of you readers, there is this "thing" between those Danes from the mainland and those on the main island ... sorry about that :slight_smile:

Not sure what your problem is, I am trying to help you, and instead you are bringing that stupid crap up.

And the fun thing is, we all understand each other over here, and we even understand everyone over where you are too, so where is the actual problem? Us over here, or people over there?

But all in all, I prefer not to waste my time like this, so this will probably be the last time trying to help you. Good luck

bld, did you read the first post?

No, I do not have a problem. But I just loooove some of the posts in this forum when it is like my (exaggerated? no, not really) example. Especially with a subject like that, typically in an unrelated forum group

So although the post was weird and pointless, he has no problem so does not need helping (well no more than the rest of us anyway).

bld:
Not sure what your problem is, I am trying to help you, and instead you are bringing that stupid crap up.

And the fun thing is, we all understand each other over here, and we even understand everyone over where you are too, so where is the actual problem? Us over here, or people over there?

But all in all, I prefer not to waste my time like this, so this will probably be the last time trying to help you. Good luck

Cool down a bit.
This whole thread was a joke from the beginning. That's why it was posted in Bar Sport.
A lot of the stuff in the Bar Sport group is just waste of time. If you don't have time to waste, stop reading it.

mowcius:
bld, did you read the first post?

I did, but also thought there must be a reason to post something. Making a post just for making one, is... Well, don't even know what to call it, besides it might be because the author just needed some attention.

perhof:
Cool down a bit.
This whole thread was a joke from the beginning. That's why it was posted in Bar Sport.
A lot of the stuff in the Bar Sport group is just waste of time. If you don't have time to waste, stop reading it.

No, because many of the things in bar sport actually got something in them, maybe not some productive, but they still got something in.

When looking back over this, I see nothing. I even asked what it was about, and instead of a reply, I get a video making fun of someone, not even sure who, because no one over here talks like that.

So maybe it was all just for fun, wonder when the part making it fun come.

bld: Undskyld.

mowcius:
You need to set it as an output though or it's not properly turned on.

Well, there you go. All this chit chat and yet, another interesting fact creeps up. I thought from this (and some other stuff done previously) that all pins start as INPUT (re)boot, except #13 because of its LED wiring basically only is usable as OUTPUT.

Hmmm. digitalWrite to an input pin is supposed to put a 20K resistor to Vcc and if the other end of the LED is at GND then yes, I get 0.2mA through the LED. It glows a lot brighter than that. And measures 4.8V ... So I tried different INPUT, OUTPUT LOW and HIGH, and yes: With INPUT the 20K pullup just barley makes the onboard LED glow. It has to be OUTPUT. And that is what pin 13 is, by default. I think I am right here. Oh well, we could look at the init code at github, but I cant be bothered now.

Constructive critism is always welcome. If the worst happens I learn someting.

All IO pins are powered up as inputs at powerup, sketches must set it to Output. Including D13.
It is certainly usable as an input. Anything driving it High just needs to supply maybe 3mA to overcome the current limit resistor and LED (assuming it has Vforward of ~2V for an 0805 LED).