Saya membuat sensor nirkabel menggunakan Attiny85. Saya ingin mengirim data ke arduino uno, jadi saya membeli kit tautan rf 315mhz dari spark fun. Karena Attiny85 tidak memiliki TX, saya memutuskan untuk menggunakan perpustakaan Manchester namun tidak dapat dikompilasi di Attiny85.
Saya mengikuti langkah-langkah dari blog ini: http://mchr3k-arduino.blogspot.mx/2012/01/wireless-sensor-node-part-2.html?showComment=1338749638806#c853067277980266192
Berikut adalah kode yang saya gunakan:
#include <WProgram.h> //otherwise it says it can't find Arduino.h
#include <Manchester.h> //include the library to comunicate
#define TxPin 2 //the pin that is used to send data
int sensorPin = 4;
int ledPin = 3;
int count = 50;
void setup(){
pinMode (ledPin, OUTPUT);
man.workAround1MhzTinyCore(); //add this in order for transmitter to work with 1Mhz Attiny85/84
man.setupTransmit(TxPin, MAN_1200); //set transimt pin
}
void loop(){
if (count == 50){
digitalWrite (ledPin, HIGH);
count = 0;
}
int data = analogRead(sensorPin);
man.transmit(data); //transmits and reads the data
delay (100);
count ++;
}
Ini pesan kesalahannya:
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp: In function 'void MANRX_SetupReceive(uint8_t)':
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:366: error: 'TCCR2A' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:366: error: 'WGM21' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:368: error: 'TCCR2B' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:368: error: 'CS21' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:369: error: 'OCR2A' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:379: error: 'TIMSK2' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:379: error: 'OCIE2A' was not declared in this scope
/Users/joelsimonoff/Documents/Arduino/libraries/MANCHESTER/Manchester.cpp:380: error: 'TCNT2' was not declared in this scope