Ich habe den Attiny85 mit der Arduino IDE programmiert, also zuerst auf den Arduino das ISP beispiel drauf programmer auf attiny umgestellt und dann attiny1mhz ausgewählt und blink sketch drauf so wurde er verkabelt verkabelt:
ATtiny -> Arduino
VCC(+) -> +5V
Pin2 (Analog Input 1, SCK) -> Pin13
Pin1 (PWM, MISO) -> Pin12
Pin0 (PWM, AREF, MOSI) -> Pin11
(-) GND -> GND
Reset -> Pin10
danach hat auch an PIN9 desArduino meine LED geleuchtet die den Herzschlag des ATtiny anzeigen soll. Sollte also funktioniert haben?
Dann habe ich umgestellt auf Attiny85 (8mhz)
und diesen Sketch hochgeladen (dieser funktioniert mit dem Arduino aber nicht mit dem Attiny85 und das ist mein Problem)
#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
const int schalter = 1 ;
const int test=3;
int Schalterzustand;
void setup()
{
// 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(2); // pin 3 is used as the transmit data out into the TX Link module, change this as per your needs
pinMode(schalter,INPUT);
pinMode(test,OUTPUT);
}
void loop()
{
Schalterzustand = digitalRead(schalter);
if(Schalterzustand == HIGH){
const char *msg = "Testnachricht"; // this is your message to send
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx();
// Wait for message to finish
digitalWrite(test,HIGH);
}
else{
digitalWrite(test,LOW);
}
delay(1000);
}
Alles anzeigen
Am Ende kam wurde der Sketch aufgespeilt und unten stand
"avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
"
Nachgelesen, dass man das getrost ignorieren kann
also sollte es ja funktioniert haben
Sobald ich jetzt meinen Schalter drücke passiert nichts
der EmpfängerSketch sieht so aus
#include <VirtualWire.h> // you must download and install the VirtualWire.h to your hardware/libraries folder
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
{
Serial.begin(9600);
pinMode(8,OUTPUT);
pinMode(5,OUTPUT);
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for RX Link Module
vw_setup(2000); // Bits per sec
vw_set_rx_pin(4); // We will be receiving on pin 4 i.e the RX pin from the module connects to this pin.
vw_rx_start(); // Start the receiver
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // check to see if anything has been received
{
digitalWrite(8,HIGH);
digitalWrite(5,LOW);
Serial.println("Hi");
}
else{
digitalWrite(8,LOW);
Serial.println("nix");
digitalWrite(5,HIGH);
}
delay(2500);
}
Alles anzeigen
Dieser funktionierte bzw funktinoert immer noch sobald der sender mit dem "Arduino selbst" arbeitet.
Verkabelung sieht wie folgt aus
http://www.directupload.net/file/d/3702/2gg642e9_jpg.htm
mfg hoffe ihr könnt mir helfen