March 17, 2015

New toy

Just picked up a bunch of these Attiny85 boards off E-bay direct from China. Delivery was about 3 weeks. They are clones of the original digispark board. They come without headers soldered on. It is up to you what you want on your boards. I went with male headers. I believe these Attiny's run at 16.5 Mhz and you have a total of 6 I/O pins (2 of the 6 are PWM). You have two options to program these chips

1 : Use a custom forked version of the original arduino IDE to get these little bad boys up running quickly.

2: The original IDE but it is much more involved.

I went the easy route

These Attiny85 clones are actually pretty amazing little boards and super cheap. You are very limited to what you can and cannot do. A good majority of the libraries for the original arduino will not work with these Attiny85's. Because of all these limitations in place it will make you think outside of the box. Remember you only have 6 pins to work with. A plus is you can run software serial on 2 pins which is a good and it will work with I2C.But like i said keep an eye on the pin count. 6 is not a lot.

I will be using these to shrink down my Uniden U Control even more. I should be able to fit everything inside the small Altoids tin. The WIKI link below will have all the information you will need to know...

Digispark WIKI


First Attiny85 Project with RGB led. Who doesn't like police lights (code is posted below)

My cell phone was jammed under my neck so i could get my hands free :)



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#define RED 0x0
#define BLUE 0x1


byte whichLED = RED;

const int LED_Red = 0;
const int LED_Blue = 2;

byte Red_State = LOW;
byte Blue_State = LOW;

unsigned long switchDelay = 250;
unsigned long strobeDelay = 50;

unsigned long strobeWait = strobeDelay;

unsigned long waitUntilSwitch = switchDelay;

void setup() {
  pinMode(LED_Red, OUTPUT);
  pinMode(LED_Blue, OUTPUT);
}

void loop() {
  digitalWrite(LED_Red, Red_State);
  digitalWrite(LED_Blue, Blue_State);

  if ((long)(millis() - waitUntilSwitch) >= 0) {
    // time is up!
    Red_State = LOW;
    Blue_State = LOW;
    whichLED = !whichLED;
    waitUntilSwitch += switchDelay;
  }

  if ((long)(millis() - strobeWait) >= 0) {
    if (whichLED == RED)
      Red_State = !Red_State;
    if (whichLED == BLUE)
      Blue_State = !Blue_State;
    strobeWait += strobeDelay;
  }
}

No comments:

Post a Comment