Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- int readstate=0;
- //This is the master arduino, currently it reads the address bus and sends it to the arduino handling memory
- //Currently untested
- void setup() {
- pinMode(2, INPUT);
- pinMode(3, INPUT);
- pinMode(4, INPUT);
- pinMode(5, INPUT);
- pinMode(6, INPUT);
- pinMode(7, INPUT);
- pinMode(8, INPUT);
- pinMode(9, INPUT);
- pinMode(10, INPUT);
- pinMode(11, INPUT);
- pinMode(12, INPUT);
- pinMode(13, INPUT);
- pinMode(A0, INPUT);
- pinMode(A1, INPUT);
- pinMode(A2, INPUT);
- pinMode(A3, INPUT);
- pinMode(A7, INPUT);
- Wire.begin();
- }
- int rpin(int pin) {
- int r1 = digitalRead(pin);
- return r1;
- }
- void loop() {
- readstate = digitalRead(A7);
- if(readstate == 0){
- //needs to be a conditional here that depends on the state of RD?
- //grab address bus from pins, store in addr
- int addr[16] ={rpin(12),rpin(11),rpin(10),rpin(9),rpin(8),rpin(7),rpin(6),rpin(5),rpin(4),rpin(3),rpin(2),rpin(13),rpin(A0),rpin(A1),rpin(A2),rpin(A3)};
- Wire.beginTransmission(8); // transmit to device #8
- Wire.print(addr[0]);
- Wire.print(addr[1]);
- Wire.print(addr[2]);
- Wire.print(addr[3]);
- Wire.print(addr[4]);
- Wire.print(addr[5]);
- Wire.print(addr[6]);
- Wire.print(addr[7]);
- Wire.print(addr[8]);
- Wire.print(addr[9]);
- Wire.print(addr[10]);
- Wire.print(addr[11]);
- Wire.print(addr[12]);
- Wire.print(addr[13]);
- Wire.print(addr[14]);
- Wire.print(addr[15]);
- Wire.print(addr[16]);
- //no matching function for call to 'TwoWire::write(int [16], int)'
- Wire.endTransmission();
- // delay(500); //Ideally this should not be here
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement