Hello, I am working on a project where I want to use two ATTINY85's as the brains of it. I plan to do this with I2C connection. I am using Arduino to upload the code. For some reason it's not working and I can't figure out why. I've look around google and I can't seem to find anything clear on how to do it. Below I will have the ATTINY85 master device code, the ATTINY85 slave code, and my wiring diagram. The right ATTINY85 is the slave device and the left is the master. Thank you for your help?
#include <TinyWireS.h>
// Slave ATTINY85
char x;
void setup() {
pinMode(1, OUTPUT); // Use pin 1 as an output
TinyWireS.begin(8);
TinyWireS.onReceive(checking);
}
void loop() {
// put your main code here, to run repeatedly:
}
void checking() {
while (TinyWireS.available() > 0) {
x = TinyWireS.receive(); // Use receive() to get the received byte
if (x == '1') {
digitalWrite(1, HIGH);
delay(1000);
} else if (x == '0') {
digitalWrite(1, LOW);
delay(1000);
}
}
}
You don't say what core you're compiling with, your wiring diagram has no power source, neither of your ATtiny's have either their Vcc or GND pins hooked up, it appears you want to use PB1 (pin 6) as an output but you have nothing hooked up to it, you have no connections on SDA (pin 5) or SCL (pin 7). And at that point I simply stopped looking.
And now your reset pins are floating. Did you disable them with a high voltage programmer or did you forget about them? How are the fuses in the ATtiny85s set? Are you using the internal oscillator? At what frequency?
I don't know why people make things so hard for themselves and anyone trying to help them.
There's a perfectly serviceable Wire library in ATTinyCore. With perfectly serviceable examples of how to write master and slave sketches. There's no need for 3rd party libraries.
And honestly, is it so hard to put together a legible schematic? You'd think they were being asked to reproduce the Mona Lisa. It's like 10 minutes work, tops.