Help modifying sketch for attiny-85 please

im not sure i did this right can someone help me out?

const byte ch1 = A0;
const byte ch2 = A3;
const byte ch3 = A2;
const byte TIP1 = 0;
const byte TIP2 = 1;
const byte TIP3 = 2;

void setup() {
  pinMode(ch1, INPUT);
  pinMode(ch2, INPUT);
  pinMode(ch3, INPUT);
  pinMode(TIP1, OUTPUT);
  pinMode(TIP2, OUTPUT);
  pinMode(TIP3, OUTPUT);
}

void loop() {
  int width1 = pulseIn(ch1, HIGH, 30000);      
  if(width1 > 1990) {
     digitalWrite(TIP1, HIGH); 
  }
     if(width1 < 1800) {
     digitalWrite(TIP1, LOW);
  }
    int width2 = pulseIn(ch2, HIGH, 30000);       
  if(width2 > 1990) {
     digitalWrite(TIP2, HIGH); 
  }
     if(width2 < 1800) {
     digitalWrite(TIP2, LOW);
  }
   int width3 = pulseIn(ch3, HIGH, 30000);    
  if(width3 > 1990) {
     digitalWrite(TIP3, HIGH); 
  }
     if(width3 < 1800) {
     digitalWrite(TIP3, LOW);
  }
}

ok now i know i didnt do something right because it wont upload :confused: any suggestions?

jeremybgilbert:
it wont upload

  • ? -

it wont upload on the attiny85
it says 'byte' does not name a type

it works with the atmega328 but how can i get this to work with the attiny? and also, did i map the pins right?

Try adding this at the top:

#include <Arduino.h>

It compiles fine for me.
I'm using the Arduino-Tiny core.
Which core are you using?
Have you successfully uploaded sketches to an ATtiny85 in the past?

i tried adding that to the top, still getting the same error about the byte
i have uploaded sketches to attinys before but ive recently rebooted and had to install the arduino software again. what core do i need?
the one i have is from high low tech or something? for 45/85

If it says byte does not name a type, it probably means that your custom core doesn't define the byte type. The byte type isn't standard C, it's an alias used by the Arduino framework. Replace your byte types with unsigned char or do:

typedef unsigned char byte;

in the beginning of your sketch.

it works! thanks guys!