Go Down

Topic: attiny45 problem (Read 1 time) previous topic - next topic

robot797

hey guys

i have a problem i have an attiny 45 here

and i want to run the virtual wire library
but it wont work it says
C:\Users\peter\Desktop\arduino-0023\libraries\VirtualWire\VirtualWire.cpp: In function 'void vw_setup(uint16_t)':
C:\Users\peter\Desktop\arduino-0023\libraries\VirtualWire\VirtualWire.cpp:259: error: 'TCCR1A' was not declared in this scope
C:\Users\peter\Desktop\arduino-0023\libraries\VirtualWire\VirtualWire.cpp:260: error: 'TCCR1B' was not declared in this scope
C:\Users\peter\Desktop\arduino-0023\libraries\VirtualWire\VirtualWire.cpp:260: error: 'WGM12' was not declared in this scope


can somone help
i realy need it

here is the script btw

Code: [Select]
// transmitter.pde
//
// Simple example of how to use VirtualWire to transmit messages
// Implements a simplex (one-way) transmitter with an TX-C1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@open.com.au)
// Copyright (C) 2008 Mike McCauley
// $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round

const int led_pin = 0;

void setup()
{
pinMode(2,INPUT);
digitalWrite(2,HIGH); //Only this line new
pinMode(3,INPUT);
digitalWrite(3,HIGH); //Only this line new
// Initialise the IO and ISR
    vw_set_ptt_inverted(true); // Required for RF Link module
    vw_setup(2000);                 // Bits per sec
    vw_set_tx_pin(1);                // pin 3 is used as the transmit data out into the TX Link module, change this to suit your needs.

}


void loop()
{
  if (digitalRead(2) == LOW) {               // check if the button is pressed
  const char *msg = "10";       // this is your message to send

   vw_send((uint8_t *)msg, strlen(msg));
   vw_wait_tx();
digitalWrite(led_pin, HIGH);   // Wait for message to finish
  delay(100);

  }
  else{digitalWrite(led_pin, LOW);}

  if (digitalRead(3) == LOW) {               // check if the button is pressed
  const char *msg = "01";       // this is your message to send

   vw_send((uint8_t *)msg, strlen(msg));
   vw_wait_tx();
digitalWrite(led_pin, HIGH);   // Wait for message to finish
  delay(100);
  }
  else{digitalWrite(led_pin, LOW);}


}

johnwasser

You'll have to port the VirtualWire library for the ATtiny45 processor.  It might just be a case of defining the timer control register but if the 45's Timer1 acts differently from the ATmega's Timer1 you will have to dig deeper.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

robot797

how will i do that

it is for an official project

so if somone can help


johnwasser

It's not a supported Arduino processor , so attiny core are you using?  The ATtiny45 has a TCCR1 (Timer/Counter Control Register 1). It doesn't, however, have a WGM12 field so you'll have to figure out from the sources what that field is being referenced for and figure out how to do that in the ATtiny45 registers.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

robot797

guys  :smiley-roll-sweat:
i can program but the level you are using is gibberich to me
that is why i asked help in the firsth place

i didnt asked help to get tips on how to do it

i asked help becaus i cant do it

pleas help =(

el_supremo

That code compiles on IDE1.0 with the current VirtualWire library 1.8 (on a Duemilanove)

Pete

robot797

for the normal arduino it works

but when you try to upload it to the attiny45 with an arduino as an isp

it does not work

Nick Gammon

Have you tried contacting the author of the library?

The docs say:

Quote
Runs on ATmega8/168 (Arduino Diecimila etc) and ATmega328 and possibly others.
http://www.gammon.com.au/electronics

Bima

Hi,

I've been wanting to do the same thing (Use Virtual Wire in an Attiny) did you get any solution to the problem?

I haven't got my Attiny yet but I've played around with the core abit.

Go Up