Hi all im trying to load up a AtTiny85 with the code below, the problem is i’m getting these errors:
Binary sketch size: 1,660 bytes (of a 8,192 byte maximum)
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
I’m hooking up the wires according to this:
the chip does nothing really. all the lights are off when +5v and GND are connected although they will light up if the GND is removed from the chip but not the leds.
oh, right, i have leds hooked up to the pins via resistors.
code:
// Motorcycle Prototype MkII
#include <LedFlasher.h>
const byte FrontPin = 3;
const byte RightIndicatorPin = 2;
const byte LeftIndicatorPin = 1;
const byte RearPin = 0;
// Flashers pin off-time on-time on?
LedFlasher LeftIndicator (LeftIndicatorPin, 500, 500, false);
LedFlasher RightIndicator (RightIndicatorPin, 500, 500, false);
// states for the state machine
typedef enum
{
initialState,
wantDippedBeam,
wantHighBeam,
wantHighBeamOff,
wantLeftIndicator,
wantRightIndicator,
wantLeftIndicatorOff,
wantRightIndicatorOff,
wantRearLight,
wantRearBrake,
wantRearBrake2,
wantRearBrakeOff,
wantRearBrakeOff2,
} states;
// state machine variables
states state = initialState;
unsigned long lastStateChange = 0;
unsigned long timeInThisState = 1000;
void setup ()
{
pinMode (FrontPin, OUTPUT);
pinMode (RearPin, OUTPUT);
// set up flashers
LeftIndicator.begin ();
RightIndicator.begin ();
} // end of setup
void doStateChange ()
{
lastStateChange = millis (); // when we last changed states
timeInThisState = 1000; // default one second between states
switch (state)
{
case initialState:
state = wantDippedBeam;
break;
case wantDippedBeam:
analogWrite (FrontPin, 125);
state = wantRearLight;
break;
case wantRearLight:
analogWrite (RearPin, 125);
state = wantRearBrake;
timeInThisState = 50000;
break;
case wantRearBrake:
analogWrite (RearPin, 255);
state = wantLeftIndicator;
break;
case wantLeftIndicator:
LeftIndicator.on();
state = wantRearBrakeOff;
timeInThisState = 5000;
break;
case wantRearBrakeOff:
analogWrite (RearPin, 125);
state = wantLeftIndicatorOff;
timeInThisState = 5000;
break;
case wantLeftIndicatorOff:
LeftIndicator.off();
state = wantHighBeam;
timeInThisState = 50000;
break;
case wantHighBeam:
analogWrite (FrontPin, 255);
state = wantRearBrake2;
timeInThisState = 20000;
break;
case wantRearBrake2:
analogWrite(RearPin, 255);
state = wantRightIndicator;
break;
case wantRightIndicator:
RightIndicator.on();
state = wantRearBrakeOff2;
timeInThisState = 5000;
break;
case wantRearBrakeOff2:
analogWrite(RearPin, 125);
state = wantRightIndicatorOff;
timeInThisState = 5000;
break;
case wantRightIndicatorOff:
RightIndicator.off();
state = wantHighBeamOff;
timeInThisState = 50000;
break;
case wantHighBeamOff:
analogWrite (FrontPin, 125);
state = wantDippedBeam;
break;
} // end of switch on state
} // end of doStateChange
void loop ()
{
if (millis () - lastStateChange >= timeInThisState)
doStateChange ();
// update flashers
LeftIndicator.update ();
RightIndicator.update ();
} // end of loop