Go Down

Topic: attiny does not send ir signal  (Read 99 times) previous topic - next topic

sakilimtiaz

Hello,
I am new in attiny 85. I want to create a attiny85 based transmitter. I compiled the code in arduino UNO it works fine. but when I compiled it in attiny85 it does not send any IR signal. I checked it several time. the same hardware settings worked in arduino but not in attiny85. with the same core and library IR receive work perfectly in attiny85. But irsend does not react. please see my code. Also thanks in advance for your help.   

transmitter code:

#include <IRremote.h>
#include <IRremoteInt.h>



IRsend irsend;

// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 0;     // the number of the pushbutton pin
const int buttonPin1 = 1; 
const int buttonPin2 = 3;     // the number of the pushbutton pin
const int buttonPin3 = 4;
const int ledPin =  2;     // the number of the LED pin

// variables will change:
int buttonState = 0;
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0; // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
//  Serial.begin(9600);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
 pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT); 
 pinMode(ledPin, OUTPUT); 
}

void loop(){

     // read the state of the pushbutton value:
  buttonState1 = digitalRead(buttonPin1);
    if (buttonState1 == HIGH) {   
    // turn LED on:   
   // for (int i = 0; i < 3; i++)
    irsend.sendNEC(0x40BD48B7, 32); // MY TV chan-up code
    delay(40);
    }
   
   
      buttonState = digitalRead(buttonPin);
      if (buttonState == HIGH) {
     //   for (int i = 0; i < 1; i++)
        irsend.sendNEC(0x40BDC837, 32); // MY TV Chan-down code
        delay(40);
      }
   
   buttonState2 = digitalRead(buttonPin2);
      if (buttonState2 == HIGH) {
     //   for (int i = 0; i < 1; i++)
        irsend.sendNEC(0x40BD8877, 32); // MY TV vol-up code
        delay(40);
      }
      buttonState3 = digitalRead(buttonPin3);
      if (buttonState3 == HIGH) {
     //   for (int i = 0; i < 1; i++)
        irsend.sendNEC(0x40BD08F7, 32); // MY TV vol-down code
        delay(40);
      }
}

Monty68

Pin 2 on the tiny85 is not PWM from what I can see, try using Pin 3 for IR led?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy