Code works on Arduino uno but not on atmega 8A-PU

code successfully run on Arduino uno and display data very well, but when i put this code on atmega 8a then there is no display... this code about 5kb so i want to use atmega 8a instead of 328pu..

#include <AceWire.h>

#include <SevenSegmentDisplay.h>

#include <Wire.h>
#include <AHT10.h>


//============================================================================
// Name        : TempControl.ino
// Author      : Romualdo Dasig
// Version     : v0.1
// Copyright   : MIT License
// Description : Display temperature to a Seven Segment LED Display
//============================================================================

// Libraries

AHT10 myAHT10(0x38);

// Setup Sensor.

// Variables
float temp; // Temperature
float hum;  // Humidity


// Variable to store current time.
unsigned long previousMillis = 0;

// Set interval to read temperature.
const long interval = 5000;

// Configure a 2-Digit 7-Segment Display.
int segments[7] = {3, 4, 7, 6, 5, 10, 8}; // Display segments (a,b,c,d,e,f,g)
int displays[2] = {12, 11}; // Display digits (00 - 99)
int type = COMMON_ANODE; // Type

SevenSegmentDisplay sevenSegmentDisplay(
  segments[0],
  segments[1],
  segments[2],
  segments[3],
  segments[4],
  segments[5],
  segments[6],
  displays[0],
  displays[1],
  type
);

void setup()
{
  Wire.begin();
  Serial.begin(9600);
   if (!myAHT10.begin()) {
    Serial.println("Couldn't find sensor!");
    while (1);
  }
  sevenSegmentDisplay.begin();
}

void loop()
{
  
  // Get current time in milliseconds.
  unsigned long currentMillis = millis();

  // Read temperature every 2 seconds.
  if (currentMillis - previousMillis >= interval) {
    // Save the last time we've read the temperature.
    previousMillis = currentMillis;

    // Read data and store it to variables hum and temp.
     hum = myAHT10.readHumidity();
    //temp= dht.readTemperature();
  }

  // Display temperature.
  sevenSegmentDisplay.display(hum);
}

How many will you manufacture? 10,000? 100,000?

Or just 1? Then the savings are definitely not worth the effort to get the code working on a different chip.

Why use both the AceWire and Wire libraries? Seems redundant, at best.

What core are you using?

Can you post a schematic? Hand drawn, photographed and posted is fine.

Did you select the "AVR -> Arduino NG or older" board? Have you burned the bootloader onto your chip?

thank u actually I did not burn a bootloader in new atmega8A...

actually I did not burn a bootloader in new atmega8A... now it work's perfectly

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.