hi, and again i got another rather >annoying< arduino situation
this is my code:
/*
Arduino schakelaar
Gepubliceerd op 18 november 2015
Conrad Electronic Benelux B.V.
http://www.conrad.nl
Benodigde onderdelen:
1 Rode LED
1 Weerstand 150 Ohm
1 Druktoets
1 Weerstand 10 kOhm
5 Draadbruggen
1 Breadboard
Dit project is onderdeel van de Conrad Arduino Starterkit.
*/
// Benoem de noodzakelijke elementen van deze sketch
const int led = 3; // De LED is aangesloten op pin 3
const int toets = 2; // De sensor (LDR) is aangesloten op pin 2
// Hier geven we eenmalig aan wat de instellingen voor deze sketch moeten zijn
void setup() {
pinMode(led, OUTPUT); // De LED dient als output voor de sketch
pinMode(toets, INPUT); // De toets dient als input voor de LED in deze sketch
}
// Hier geven we aan welke stappen de Arduino moet afwerken in de sketch
void loop() {
int toetsWaarde = digitalRead(toets); // Lees de digitale waarde van de toets uit en sla deze op als toetsWaarde
if(toetsWaarde == HIGH){ // Als de toets wordt ingedrukt (er loopt dus spanning door de toets)
digitalWrite(led, HIGH); // Zet de LED aan (HIGH betekent spanning op de LED)
} else { // Wanneer de toets niet wordt ingedrukt
digitalWrite(led, LOW); // Zet de LED uit (LOW betekent geen spanning op de LED)
}
}
verified and uploaded with arduino 1.8.2
all is connected well (i guess)
instead of a 150R resistor i did use a 100R + 47R in series
pressing button... no LED turns on
(read this!, i did succeed to blink a led, to fade a led, to let a stepper motor turn CC and CCW)
i do have an pulldown resistor (100K) and >at the right spot< so:
arduino wont let me shine a (well connected) led with a (well connected) push button with a well programmed sketch (got the sketch from www.conrad.nl's starterkit)
arduino even wont let me upload a >>>113kb<<< jpg in here
is there anything left arduino WILL let me???
(btw, how does one put JPG's in here??? arduino just mention "a couple of hundreds", can be 200, 300, 400?, anyway, it even wont let me upload a 113kb)
Not everyone has the same starter kit as you, or any starter kit.
You may not be able to post pics because you have not enough posts yet. I don't like that rule. I understand it is to stop spammers and bots from invading the forum. But it also stops beginners from following form rules about posting images and stops them from getting the help they need.
No, it doesn't, and that leads to new forum members posting broken links, or links to sites that are difficult to view on smartphones, pictures that are way too large or overly compressed... It would be so much easier to help them if they could attach their images to their first post (and the forum automatically showed image attachments as it once did). But I realise allowing that would open the door to spammers.
keith12345:
hi Sterretje (guess you're dutch, am i right?) thanx for ur ASCII art anyway
now just a LED and a push button and of course an arduino (clone) are involved in my configuration (so no LDR)
the 5v led should be secured with 150r as i used 2 resistors in series (100r + 47r) that should work as it did for my fading led
a 100K resistor ought to be connected too between pushbutton and gnd for some reason
i cant put a jpg in here for arduino wont let me upload even thát wont work at arduino...
(btw my configuration concerns the switch sketch from the arduino starter kit)
You need to stop blaming everything at "Arduino". That doesn't motivate people to help you.
1 Weerstand 10 kOhm >> It says 10.000 ohm resistor. Not 100.000 ohm resistor. You could even read into using INPUT_PULLUP for the push button. Then you won't even be needing the 10.000 ohm resistor.
Maybe you could describe us better how you connected everything.
Maar ga je alsjeblieft een beetje gedragen. Gebruik gewoon normale zwarte letters.
Try this simple change - look for a LOW button press instead of HIGH. Wire your button to connect pin 2 to GND when pressed:
[pre][code]
/*
Arduino schakelaar
Gepubliceerd op 18 november 2015
Conrad Electronic Benelux B.V.
http://www.conrad.nl
Benodigde onderdelen:
1 Rode LED
1 Weerstand 150 Ohm
1 Druktoets
1 Weerstand 10 kOhm
5 Draadbruggen
1 Breadboard
Dit project is onderdeel van de Conrad Arduino Starterkit.
*/
// Benoem de noodzakelijke elementen van deze sketch
const int led = 3; // De LED is aangesloten op pin 3
const int toets = 2; // De sensor (LDR) is aangesloten op pin 2
// Hier geven we eenmalig aan wat de instellingen voor deze sketch moeten zijn
void setup() {
pinMode(led, OUTPUT); // De LED dient als output voor de sketch
pinMode(toets, INPUT_PULLUP); // De toets dient als input voor de LED in deze sketch <<< TURN ON INTERNAL PULLUP RESISTOR
}
// Hier geven we aan welke stappen de Arduino moet afwerken in de sketch
void loop() {
int toetsWaarde = digitalRead(toets); // Lees de digitale waarde van de toets uit en sla deze op als toetsWaarde
if(toetsWaarde == LOW){ // Als de toets wordt ingedrukt (er loopt dus spanning door de toets) <<< LOOK FOR A LOW
digitalWrite(led, HIGH); // Zet de LED aan (HIGH betekent spanning op de LED)
} else { // Wanneer de toets niet wordt ingedrukt
digitalWrite(led, LOW); // Zet de LED uit (LOW betekent geen spanning op de LED)
}
}
hi, first of all i found out the Conrad webshop tutorial sketch talks about a LDR (some sensor?) where it should be pushbutton
is a pushbutton the same as a (LDR) sensor?
as arduino should be for newbie's/beginners as well, then why first talking about simple circuits and right after talking about something odd like a "pull-down resistor" where it still doesn't fit in the beginners concept of the same simple circuit?
till this day and after trying and trying i still didn't succeed to let a led shine with a push on the pushbutton The arduino forum >won't even let me upload a 149 kb attachment< with the jpg from my breadboard etc
am thinking now about buying an Adafruit thingie for Adafruit tutorials at least are CLEAR and do show sketches AND breadboard schemes! and both of these are understandable where just arduino sketches are not (for a newbie)
(in dutch and just to L. : blauwe letters hebben echt helemaal niks te maken met je wel of niet gedragen, wel bij het onderwerp blijven ok! Translated: blue text is ok as far as i'm concerned, please stick to the subject ok! )
keith12345:
is a pushbutton the same as a (LDR) sensor?
No, a few seconds searching would have answered that. The code you posted refers to an LDR:
keith12345:
const int toets = 2; // De sensor (LDR) is aangesloten op pin 2
so if you're not using an LDR then why does your code mention it? If you just want a to control an LED with a button then I recommend using File > Examples > 02.Digital > Button and https://www.arduino.cc/en/Tutorial/Button
keith12345:
as arduino should be for newbie's/beginners as well, then why first talking about simple circuits and right after talking about something odd like a "pull-down resistor" where it still doesn't fit in the beginners concept of the same simple circuit?
If you want to use a button you need a pull-up or pull-down resistor. There's no way to get around that, sorry if you don't like it. Arduino tries to remove any unnecessary complications to make microcontrollers beginner friendly but this is an inherently complex subject. If you're not willing to engage your brain and do some research when you get confused then you should give up and go watch TV instead. If you want to learn how to use Arduino then it's time to roll up your sleeves and stop whining. This is big boy stuff. The Arduino does have internal pull-up resistors you can enable, see the "INPUT_PULLUP" section of: https://www.arduino.cc/en/Tutorial/DigitalPins
Some beginners tutorials will tell you to use an external resistor. I believe this is done for two reasons:
The external resistor makes it obvious how the circuit works rather than using an invisible internal resistor.
Beginners expect a HIGH to be the active state and that is only possible with a pull-down resistor rather than the pull-up which is all that is available internally.
keith12345:
The arduino forum >won't even let me upload a 149 kb attachment< with the jpg from my breadboard etc
wahhh. sterretje already showed how you can post a schematic using only text and I see that you have now figured out how to attach images. For bonus points you can also embed them following these instructions: http://forum.arduino.cc/index.php?topic=364156.0
keith12345:
am thinking now about buying an Adafruit thingie
keith12345:
till this day and after trying and trying i still didn't succeed to let a led shine with a push on the pushbutton
Make sure the LED is connected the right way. You need to connect the cathode to ground. LEDs often have a flat spot on the plastic to indicate which lead is the cathode. If that doesn't fix the problem then try taking the button out of the breadboard, turning it 90 degrees, then plugging it back into the breadboard. You can make sure these sorts of button will always work in any orientation by connecting to the legs on opposite corners.