Hi, i would like to start a project in arduino but i am having trouble in making one because currently i have no idea how to start a code for the 2 lights to function. I read many topics in these forums but none of them worked for me, so please assist me here i would like to have the sensor to detect a distance and it would turn the red led on/green led on.
Step by step.
You shoukd be able to find examlke code that just reads the sensor and prints to the serial monitor.
On the IDE, libraries often come with examples. Look there first.
Have fun getting that going first. Worry about what to do and how with the numbers that gives you as a later step.
a7
Hi @mikeykun,
welcome to the arduino-forum.
If you want to receive really good help you have to help your helpers by providing detail-information
- what exact type of microcontroller are you using?
- what kind of sensor are you using for measuring the distance?
- depending on the type of LEDs and the type of microcontroller you are using different resistors are nescessary to avoid destroying your leds and your microcontroller.
welcome to the arduino-forum.
I'm pretty sure that you agree and will follow the way how to solve your problem mimimum 200 minutes faster.
This requires to invest 20 minutes of your precious time to read how to speedup solving your problems.
Directly after registering you got presented informations how to speed up solving your problem.
You should really read it.
best regards Stefan
Here, maybe I've guessed correctly:
HTH
a7
Your topic is lacking about every detail possible. What kind of sensor? What kind of lights?
I suggest that you start studying the examples that come with the IDE. I'm sure there are examples how to control a LED; the LED can possibly later be replaced by something else. I'm also quite sure that there are examples how to read a button or an analogue signal. Later you can replace that by the code for a digital or analogue sensor.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.