I am making a basic computer and the chip that syncs everything together is an Attiny85. This chip tells others when they can do things on the data bus.
The principle of how it works is that whenever pin PB0(labeled 11 in IDE or intPin in the code) is set HIGH, the ATtiny85 set all pins LOW then the corresponding pin of the next chip HIGH.
The problem is in the attachPinToInterrupt() statement.
I get this error message when I try to compile the code: Arduino: 1.8.9 (Mac OS X), Board: "ATtiny25/45/85, ATtiny85, Internal 8 MHz"
/Users/alexandrebergeron/Documents/Arduino/computer/computerClock/computerClock.ino: In function 'void setup()':
computerClock:11:47: error: 'digitalPinToInterrupt' was not declared in this scope
attachInterrupt(digitalPinToInterrupt(intPin), procDone(), RISING);
^
exit status 1
'digitalPinToInterrupt' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Here's my code:
//common vars
volatile int priority = 0;
//pin numbers
const int intPin = 11;
const int cpuPin = 6;
const int videoPin = 13;
void setup() {
pinMode(intPin, INPUT);
attachInterrupt(digitalPinToInterrupt(intPin), procDone(), RISING);
pinMode(cpuPin, OUTPUT);
pinMode(videoPin, OUTPUT);
}
void procDone() {
digitalWrite(cpuPin, LOW);
digitalWrite(videoPin, LOW);
switch(priority) {
case 0:
digitalWrite(cpuPin, HIGH);
break;
case 1:
digitalWrite(videoPin, HIGH);
break;
}
}
void loop() {
// put your main code here, to run repeatedly:
}
I anybody could help me it would be very appreciated.
Because the chip is only doing that, can it be possible to do something like this?
bool clock = true;
void loop() {
if (digitalRead(intPin)==LOW) {
if (clock==true) {
procDone();
}
}
}