Welcome to the Arduino Workshop, where you’ll be able to follow our guided course which covers everything you’ll need to know in order to create your own Arduino projects and become a leveled up maker. My name is Sam and along wit…
If you found this workshop useful, the single most wonderful way to help us keep making more is to share or recommend it to someone
We’re full time makers and are here to help! If you have any questions what-so-ever, then please post a new forum topic and we’ll dive into it straight away.
Hello, I’ve spent the last 2 days trying various Arduino courses,and couldn’t even get the LED to blink.I found your course about 2 hours ago,and have now got my LED blinking,and am ready to start the next section.Thanks very much! Regards-Ian Lennox
I completed your Arduino workshop 4.1 arrays. My LEDs would come on then off but that was it. The loop would not repeat. Even tried copying your sketch and two different Arduino Unos. Any help here?
Found a solution for the Arduino workshop 4.1 arrays. in the array to turn on the LEDs I made i=0. Maybe my version compiler does not do it automatically. Using Arduino 1.8.8 IDE. Thank you, Doug
Good catch! There must have been a change in the compiler at some point, the code used to work as it was written. I seem to remember it working that way anyway, maybe I’ve just been programming too much with Python lately
I corrected the code in the examples with your fix, and I did a little checking and i does need to be given a value for a ‘for’ loop to run.
Looking to get into programming and a friend of mine gifted me a “freetronics eleven”. I could not find any tutorials however after research it did say its arduino compatible. Would that mean the tutorials for arduino would be similar or same as the eleven or completely different? Any guidance will be appreciated!
There’s some differences between the capabilities of the freetronics eleven and a standard Arduino such as a Uno or a Mega. But it essentially is still the same thing and will still work for the majority of tutorials available, plus some eleven specific projects.
I’m only in to Chap 2, Blink Rate Control lesson and not having any success. I can read and write code but electronics is a black art for me. The trimpot I have is different to the one in the lesson in that it’s round, with a flat edge where 2 of the pins are, 1 on each “corner” and the remaining pin is at the “top” of the circle of the pot. Is there a difference in trimpots? The result I’m getting is random pulses on the LED. I’m assuming it’s reading pin 3 and not A0? Apologies for the dumb question.
If you post your script that you’re using to control the Blink Rate, when I’m back in this forum I can take a look at it and see whether the issue is related to the syntax or scripting of the program. Don’t worry about apologizing we’re here to help!
void loop() {
// read the value of the pot and store it as potValue
int potValue = analogRead(potPin);
// turn led on and wait for the time equal to potValue
digitalWrite(ledPin, HIGH);
delay(potValue);
// re-read the value of the pot and store it as potValue
potValue = analogRead(potPin);
// turn led off and wait for the time equal to potValue
digitalWrite(ledPin, LOW);
delay(potValue);
}
I have GND connected to the left pin of the trimpot, 5v connected to the right pin and A0 connected to the middle pin. I’ve removed the push button and the leads connected to it, ie GND and pin 2, thinking that that may make a difference. But it didn’t.
Hey Bryce, I took all the components and jumpers/leads off the breadboard, put them all back on, carefully following the wiring diagram - and it worked - for as long as it took me to write this. ???
Actually, even that’s not quite true. As I write, I’m testing more. With the trimpot fully counter clockwise, the LED “misbehaves”. With the trimpot fully clockwise, the LED performs correctly - most of the time. Turning the trimpot counter clockwise slowly, the LED does as expected. Until the trimpot is left, ie take your fingers off it. I wonder if I have a faulty trimpot?
Potentially. I’d recommend using a multi-meter if you have one available and testing to see whether the resistance is jumping and whether there’s continuity across the pins. Also be sure to give the whole thing a thorough cleaning as that may be causing the issues when you stop applying pressure (or simply a faulty connection).
If not try running this modified code (will need reformatting) and see whether the jumpiness follows any patterns from the Serial viewer at 9600 baud
Thanks for all your help. I’ve discovered that the trimpot doesn’t like sitting on the breadboard. It’s not making a reliable enough connection. It’s all good when I apply pressure to it but then it disconnects. So the LED ends up being fed from pin 3.
I ran your code and initially the serial monitor showed 1023, no matter the position of the trimpot. Then after turning the trimpot and taking my fingers off it, the potValue shown by the serial monitor is all over the place.