Tiny3217 EEPROM problems

I have a sketch I have uploaded on to an ATTiny3217. I have assigned 3 digital pins as outputs but there is no output (connected to LEDs via 150 ohm and only 1 is on at a time).

This sketch works fine on an UNO and a Nano. All I have done is change the pin numbers. Is there anything special about the 3217s digital out I should know about. I am using pins 17,18 and 19.

After having a bit more of think it could actually be not writing to the EEPROM. The LEDs are lit depending on the value stored in the EEPROM. Is it possible the it is disabled by default?

Figure out which it is!

Then post a sketch which reproduces the problem so I can investigate it, since I presume you are using my core...

It appears to be the EEPROM.

The digital output relies on the reading from the EEPROM.

I will post the sketch a little later.

PS. Yes, your core.

Here is the sketch.

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Wire.h>
#include <EEPROM.h>
//#include <GEARS_TNR.h>
#include <GEARS_TNR_INV.h>

#define OLED_RESET 4

int Gear;
int sensorVal;
int out1 = 17;
int out2 = 18;
int out3 = 19;

Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);


void setup()
{

  delay(500); //wait to settle
  pinMode(out1, OUTPUT);
  pinMode(out2, OUTPUT);
  pinMode(out3, OUTPUT);

  // Read sensor value
  sensorVal = analogRead (A0);

  //Save Gear to EEPROM

  if (sensorVal < 666 )

  {
    // No Change
    Gear = EEPROM.read(0); //Load gear from EEPROM
  }
  else if  (sensorVal < 800)
  {
    Gear = 1; //4th Gear
  }
  else if  (sensorVal < 905)
  {
    Gear = 2; //5th Gear
  }
  else if (sensorVal < 1023)
  {
    Gear = 3; //6th Gear
  }

  EEPROM.update(0, Gear); // Only writes if different

  switch (Gear)
  {
    case 1:  digitalWrite(out1, HIGH); break;
    case 2:  digitalWrite(out2, HIGH); break;
    case 3:  digitalWrite(out3, HIGH); break;
  }

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //or 0x3D
  display.setRotation(3);

}

void loop()
{

  // Read sensor value
  sensorVal = analogRead (A0);

  // Gear = EEPROM.read(0); //Load gear from EEPROM

  if (sensorVal > 301)

    switch (Gear)
    {
      case 1:  digitalWrite(out1, HIGH); break;
      case 2:  digitalWrite(out2, HIGH); break;
      case 3:  digitalWrite(out3, HIGH); break;
    }

  if (sensorVal > 301 and sensorVal <= 420)
  { display.clearDisplay (); //for Clearing the display
    display.drawBitmap (0, 0, GEAR1, 64, 128, 1);
    display.display ();
  }

  else if (sensorVal > 421 and sensorVal <= 540)
  { display.clearDisplay (); //for Clearing the display
    display.drawBitmap (0, 0, GEAR2, 64, 128, 1);
    display.display ();
  }

  else if (sensorVal > 541 and sensorVal <= 665)
  { display.clearDisplay(); //for Clearing the display
    display.drawBitmap (0, 0, GEAR3, 64, 128, 1);
    display.display ();
  }

  else if (sensorVal > 666 and sensorVal <= 800)
  { display.clearDisplay (); //for Clearing the display
    display.drawBitmap (0, 0, GEAR4, 64, 128, 1);
    display.display ();
  }

  else if (sensorVal > 801 and sensorVal <= 905)
  { display.clearDisplay (); //for Clearing the display
    display.drawBitmap (0, 0, GEAR5, 64, 128, 1);
    display.display ();
  }

  else if (sensorVal > 906 and sensorVal <= 1023)
  { display.clearDisplay (); //for Clearing the display
    display.drawBitmap (0, 0, GEAR6, 64, 128, 1);
    display.display ();
  }

  else if (sensorVal <= 300)
  {
    digitalWrite(out1, LOW);
    digitalWrite(out2, LOW);
    digitalWrite(out3, LOW);

    display.clearDisplay (); //for Clearing the display
    display.drawBitmap (0, 0, GEAR7, 64, 128, 1);
    display.display ();
  }

  delay (0);

}

Hey DrAzzy,

Have you had a chance to look at this problem yet?

Anyone help with this?

Hi, I have not had a chance to look at this, it is likely a bug in my core.

Thats cool. I was just wondering how you were going.

Hey DrAzzy,

Who do you use to make your PCBs?