Help with attiny 85

Thanks for all the AWESOME help!

:slight_smile:

I did it! Just few details that had me tripped up. This is really pretty amazing stuff. Sure, I'm just blinking a light but programming a little IC that runs without any other assistance just amazes the sh!t out of me 8)

I picked up a proto shield and some odds and ends from RS and I'm thinking about making a dedicated 85 programmer. Any input on this? Input on some 85 projects?

I'm shooting for a 328 programmer for some permanent projects.

Thanks again!

Here's a sketch that works with the 85 and an Sr04 sensor:

//"Arduino Garage Tennis Ball."  A distance sensor with LED Stoplights for people with multiple vehicles going into a limited space.

const int triggerPin = 0;
const int echoPin = 1;
int redPin=2;
int yellowPin=3;
int greenPin=4;
long duration;
long distance;

void setup(){
  pinMode (13, OUTPUT);
  pinMode (12, OUTPUT);
  pinMode (11, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  int stopDistance=6;//object distance in inches from sensor that you want to trigger the Red LED.
  int warnDistance=60;//object distance in inches from sensor that you want to trigger the Yellow LED.
  pinMode(triggerPin, OUTPUT);
  digitalWrite(triggerPin, LOW);
  delayMicroseconds(2);
  digitalWrite(triggerPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(triggerPin, LOW);
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);
  distance = duration / 72 / 2;//determines distance in inches of object from sensor by microseconds to inches formula.
  if (distance >= warnDistance){
    digitalWrite (redPin, LOW);
    digitalWrite (yellowPin, LOW);
    digitalWrite (greenPin, HIGH);
  }
  else if((distance>stopDistance) && (distance<warnDistance)){
    digitalWrite (redPin, LOW);
    digitalWrite (yellowPin, HIGH);
    digitalWrite (greenPin, LOW);
  }
  else{
    digitalWrite (redPin, HIGH);
    digitalWrite (yellowPin, LOW);
    digitalWrite (greenPin, LOW);
  }
  Serial.println (distance);
}

It uses all of the 85's pins and it's a little wonky but it's close. All it does is light 3 LEDs based on distance from the sensor. I think the code is screwy but the hardware seems to be doing it's part!

Look ma, no Arduino: