I'm sure this is simple but at the moment the programming is beyond my knowledge. I just finished the "Getting Started with Arduino" book and I have a project in mind.
I would like to write a program that will turn pins high or low in a pattern that I design and at a speed that I set. I understand the basics of pin designation and timing but do not know how to write the main guts of the program.
In Example,
Turn pin 13 high for 10ms, then low for 20ms
Turn pin 13 high for 10ms, then low for 20ms
Turn pin 12 high for 10ms, then low for 20ms
Turn pin 12 high for 10ms, then low for 20ms
The idea is to write my own pattern for a flashing set of LED lights for a project I'm building.
Any guidance would be greatly appreciated.
I'm using an Arduino Duemilanove with an ATMega128.
My goal is to eventually program an ATTiny13. I'm only looking to drive 2-4 pins total.
Thanks for the response. I played with the blink program yesterday and figured out almost everything I needed.
I do have one question.
Is there a way to make two pins write high at the same time?
This is the coding I'm using right now but I wanted to see if there is a more efficient way to write the code.
Yes, you can turn them on and off in any combination you want.
Moving a servo motor with the arduino is just as easy.
You tell it which degree to go to, like Servo1.write(90);, and how long to delay after that. Look into the servo library for that.
Look at the blink without delay example and learn how to do it for yourself. 'delay' effectively stops everything for the stated time, Keeping the sketch running means that LEDs can be switched on and off in any order at any time. You could have one flashing at a steady once a second whilst another flashes 3.74 times a second and another turns on and off every minute and 12.35 seconds- impossible using delay.
Excellent, Thanks guys! I'm going to read threw the info and work on my coding this evening when I get home. I know that after I get over the hill, this will all start to make sense.