loading

Step 6: Uploading Arduino sektch to ATtiny85

Here is the sketch for 5 channel running light sketch, you must upload to the ATtiny85.

/ / The sketch demonstrate a 5 channel running light using ATTiny45/85 micro controller

# Define CH1 0 / / ATTiny45/85 PIN5
# Define CH2 1 / / ATTiny45/85 PIN6
# Define CH3 2 / / ATTiny45/85 PIN7
# Define CH4 3 / / ATTiny45/85 PIN2
# Define CH5 4 / / ATTiny45/85 PIN3

long interval = 1000; / / set the LED blink speed (1000ms = one second)

void setup ()
{
pinMode (CH1, OUTPUT); / / set CH1 as output
pinMode (CH2, OUTPUT); / / set CH2 as output
pinMode (CH3, OUTPUT); / / set CH3 as output
pinMode (CH4, OUTPUT); / / set CH4 as output
pinMode (CH5, OUTPUT); / / set CH5 as output
}

void loop () {
digitalWrite (CH1, HIGH); / / set the LED on
delay (interval); / / wait for a second
digitalWrite (CH1, LOW); / / set

digitalWrite (CH2, HIGH); / / set the LED on
delay (interval); / / wait for a second
digitalWrite (CH2, LOW); / / set the LED off

digitalWrite (CH3, HIGH); / / set the LED on
delay (interval); / / wait for a second
digitalWrite (CH3, LOW); / / set the LED off

digitalWrite (CH4, HIGH); / / set the LED on
delay (interval); / / wait for a second
digitalWrite (CH4, LOW); / / set the LED off

digitalWrite (CH5, HIGH); / / set the LED on
delay (interval); / / wait for a second
digitalWrite (CH5, LOW); / / set the LED off
}


Follow step below to upload sketch to ATtiny85
1. Comeback to the Arduino software and select File>New from menu
2. Copy above running light source code to your Arduino work space.
3. Click on Tools>Board>ATtiny85 (w / Arduino as ISP) as shown in figure below
4. Click the Upload icon to begin upload Sketch to ATtiny85

<p>have you used with a external crystal? if so do you need to change the board files to use a external crystal? there is no option by default for a external crystal</p>
<p>that I can do to convert 2 PWM inputs (rc servo) to 5Vdc analog?</p>
The photo in Step 9 gave me an idea to create a standalone Arduino ISP in a prototype shield to mount over this one another shield, with the socket and the components to flash the Bootloader and also flash a sketch in a ATMEGA328. <br/>I have been busy a couple of weeks!<br/>Thank you!
Could you also control a servo/lcd with the attiny?
Servo Tester based on ATTiny85 <br>https://trandi.wordpress.com/2013/06/18/servotester/
This may help you for servo. <br> <br>http://www.cunningturtle.com/attiny4585-servo-library/
I am looking to do something like this for my servo need smching if I were to follow the link on cunningturtle.com would I just add that code instead of the code that was listed in this instructable onto sketch? Thanks for you help.
You have to follow my procedures to burn the code (servo sketch provided by cunningturtle.com) to the ATTiny45/85
I am looking to do something like this for my servo need smching if I were to follow the link on cunningturtle.com would I just add that code instead of the code that was listed in this instructable onto sketch? Thanks for you help.
I am looking to do something like this for my servo need smching if I were to follow the link on cunningturtle.com would I just add that code instead of the code that was listed in this instructable onto sketch? Thanks for you help.
I didn't test with servo, anyway it support LCD. See the instructable by baharini. <br> <br>http://www.instructables.com/id/ATTiny4585-LCD-display-control-with-a-shift-regis/?ALLSTEPS
Nice post. Thanks. <br>On your &quot;5 channel running light circuit&quot;, it's a good idea to tie the reset (pin 1) to 5V. If you leave it floating, you may find the AtTtiny resets itself randomly. If you use a resistor with a high enough value (10k) for this &quot;pull-up&quot;, you can still program it with your ISP.
Yes, you are correct.
Here is some extra help for those using the Mega ADk or Mega 2560 instead of the Uno or Due.<br> <br> Check it out:<br> <a href="https://www.youtube.com/watch?v=DebJ1s5I3QM" rel="nofollow">https://www.youtube.com/watch?v=DebJ1s5I3QM</a>
You can actually get the chip on the uno, the atmega 328, for cheaper then you can get the ATtiny. Amazon currently sells the atmega 328 for 1$ a piece.
Are you sure? <br>The cheapest ATMega328 that I can get from Element14 (Farnell Malaysia) is RM12.99 (about US 4.16)
You can make the code smaller with a for loop.
Tried this one today. But i get an error: &quot;avrdude: usbdev_open(): did not find any USB device &quot;usb&quot;&quot;. What does that mean?
Are you using Arduino duemilanove as your AVRISP? Make sure you can upload AVRISP sketch (from Arduino software example) to your Arduino duemilanove first.
thanks for the info, I keep meaning to starting messing around with the ATtiny, maybe this will motivate me to really do it!

About This Instructable

81,109 views

195 favorites

License:

Bio: A place for DIY projects
More by smching: How to setup and use the NEJE DK-5 Pro-5 Laser Engraver/Cutter Wi-Fi controlled Remote Control Car without microcontroller L298N Motor Driver Controller Board
Add instructable to: